Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install fails (compile error) with Python 3.7rc1 #11320

Closed
pgdr opened this issue Jun 19, 2018 · 29 comments
Closed

pip install fails (compile error) with Python 3.7rc1 #11320

pgdr opened this issue Jun 19, 2018 · 29 comments

Comments

@pgdr
Copy link

pgdr commented Jun 19, 2018

Description

Unable to pip install(compile error: PyThreadState has no member ...) with Python 3.7rc1.

My apologies if this has been reported, but I couldn't find it in the issues (closed/open) nor any pull request for it.

There have been similar issues with pyyaml (yaml/pyyaml#126), numpy (numpy/numpy#10500), cython (cython/cython#1978), and pygame (pygame/pygame#382).

Steps/Code to Reproduce

Install Python 3.7rc1.
pip install scikit-learn

Expected Results

pip succeeds.

Actual Results

Compilation errors:

...
sklearn/cluster/_dbscan_inner.cpp: In function ‘int
__Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:

sklearn/cluster/_dbscan_inner.cpp:6029:24: error: ‘PyThreadState’ has no member named ‘exc_type’
     tmp_type = tstate->exc_type;
                        ^
sklearn/cluster/_dbscan_inner.cpp:6030:25: error: ‘PyThreadState’ has no member named ‘exc_value’
     tmp_value = tstate->exc_value;
                         ^
sklearn/cluster/_dbscan_inner.cpp:6031:22: error: ‘PyThreadState’ has no member named ‘exc_traceback’
     tmp_tb = tstate->exc_traceback;
                      ^
sklearn/cluster/_dbscan_inner.cpp:6032:13: error: ‘PyThreadState’ has no member named ‘exc_type’
     tstate->exc_type = local_type;
             ^
sklearn/cluster/_dbscan_inner.cpp:6033:13: error: ‘PyThreadState’ has no member named ‘exc_value’
     tstate->exc_value = local_value;
             ^
sklearn/cluster/_dbscan_inner.cpp:6034:13: error: ‘PyThreadState’ has no member named ‘exc_traceback’
     tstate->exc_traceback = local_tb;
             ^
error: Command "g++ -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g
-fwrapv -O3 -Wall -fPIC
-I/data/install/lib/python3.7/site-packages/numpy/core/include
-I/data/install/lib/python3.7/site-packages/numpy/core/include
-I/data/install/include/python3.7m -c sklearn/cluster/_dbscan_inner.cpp -o
build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o -MMD -MF
build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o.d" failed with exit
status 1

Versions

Linux-3.10.0-862.el7.x86_64-x86_64-with-redhat-7.5-Maipo
Python 3.7.0rc1 (default, Jun 19 2018, 10:54:58) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
NumPy 1.14.5
SciPy 1.1.0
@rth
Copy link
Member

rth commented Jun 19, 2018

Thanks for reporting this!

Does installation of the latest dev version works?

pip install https://github.com/scikit-learn/scikit-learn/archive/master.zip

Note that you would need Cython >=0.27.3 to compile it..

(Linking to #11224 for future reference)

@jnothman
Copy link
Member

jnothman commented Jun 20, 2018 via email

@rth
Copy link
Member

rth commented Jun 20, 2018

Yes, according to cython/cython#1955 the minimum requirements under Python 3.7 is Cython 0.27.3 where this issue was fixed. In #11224 I can confirm that the build works fine with Cython 0.28.

The minimal Cython version in doc/developers/advanced_installation.rst should probably be updated accordingly for Python 3.7

@jnothman
Copy link
Member

jnothman commented Jul 1, 2018

The easiest way for us to move towards Python 3.7 support is for us to use it in our daily "latest dependencies" job. But this is easiest when NumPy and SciPy are supporting Python 3.7. NumPy is producing wheels for 3.7. At the moment, SciPy isn't making builds on Python 3.7, but is working on it (scipy/scipy#8988). We will try to follow suit.

IMO, we should not worry about Python 3.7 support in v0.20.0, but deal with it in a bug fix release (0.20.1 or 0.20.2), given the limited support in SciPy and Six (benjaminp/six#241).

@rth
Copy link
Member

rth commented Jul 2, 2018

IMO, we should not worry about Python 3.7 support in v0.20.0, but deal with it in a bug fix release (0.20.1 or 0.20.2),

To summarize the situation for Python 3.7,

@cbrnr
Copy link
Contributor

cbrnr commented Jul 3, 2018

SciPy now has binary wheels for Python 3.7 (all platforms).

@jnothman
Copy link
Member

jnothman commented Jul 3, 2018

FWIW, #11409 identifies that we can build with the development versions of numpy, scipy and cython, and all tests pass (albeit with PendingDeprecationWarning and DeprecationWarning). It does not try to run the example gallery, though. Nor does it try building in Windows (perhaps it should).

@sam-s
Copy link
Contributor

sam-s commented Jul 3, 2018

homebrew upgraded me to python 3.7.0 and I am now left without scikit-learn.
when do you think I will be able to do pip3 install scikit-learn? a week? a month? a year?
I need this information to decide whether to wait or to downgrade to 3.6.*.
Thank you very much.

@rth
Copy link
Member

rth commented Jul 3, 2018

when do you think I will be able to do pip3 install scikit-learn? a week? a month? a year?

A month very roughly for the next release. Meanwhile you can either install the development version #11320 (comment) or downgrade to python 3.6.

@jnothman
Copy link
Member

jnothman commented Jul 3, 2018 via email

@rth
Copy link
Member

rth commented Jul 4, 2018

Given the amount of issues that were opened lately about it, it might be preferable indeed. It will also simplify comparisons / regression tracking between 0.19.x and 0.20.x for people using Python 3.7 in the future.

@lesteve
Copy link
Member

lesteve commented Jul 4, 2018

If we end up doing a 0.19.2 release, here are two things to consider adding because they missed 0.19.1 for no particular good reason.

@coulanuk
Copy link

coulanuk commented Jul 6, 2018

On Ubuntu 18.04 the recommended workaround works:
pip install https://github.com/scikit-learn/scikit-learn/archive/master.zip

@bgyarfas
Copy link

bgyarfas commented Jul 9, 2018

@rth

A month very roughly for the next release. Meanwhile you can either install the development version #11320 (comment) or downgrade to python 3.6.

Homebrew has updated their default python installation to 3.7. Since homebrew doesn't allow for installing specific versions downgrading to 3.6 is not an easy prospect. Just an FYI

@shusso
Copy link

shusso commented Jul 9, 2018

@bgyarfas it should be possible to downgrade from python 3.7 back to 3.6.5 in brew

brew info python3
brew switch python 3.6.5

@cbrnr
Copy link
Contributor

cbrnr commented Jul 10, 2018

This works only if the previous version is still cached on the local machine.

@ledona
Copy link

ledona commented Jul 10, 2018

@bgyarfas If you don't have 3.6 cached in homebrew you can use pyenv. The following worked for me...

brew install pyenv
pyenv install 3.6.5
eval "$(pyenv init -)"
pyenv shell 3.6.5
pip install virtualenv
virtualenv venv-3.6
source venv-3.6/bin/activate

You can do this without virtualenv, but my typical setup relies on it.

@cbrnr
Copy link
Contributor

cbrnr commented Jul 10, 2018

I think the point is that the average Homebrew user will have Python 3.7 by default.

@rth
Copy link
Member

rth commented Jul 10, 2018

I think the point is that the average Homebrew user will have Python 3.7 by default.

A minor 0.19.2 release that will support Python 3.7 is in progress.

@sam-s
Copy link
Contributor

sam-s commented Jul 12, 2018

what is the timeline for the 19.2 release?
thanks!

@shoeffner
Copy link

@sam-s If you need it now, you can try installing the master branch using the latest cython version:

pip install -U cython
pip install -e git+https://github.com/scikit-learn/scikit-learn@master#egg=scikit-learn

This worked for me on Python 3.7 using pipenv.
Of course, when the release is available, you should swap from the (possibly) unstable master branch to the correct release.

@jnothman
Copy link
Member

jnothman commented Jul 12, 2018 via email

@samueldg
Copy link

Release 0.19.2 is now available on PyPI: https://pypi.org/project/scikit-learn/0.19.2/

@rth
Copy link
Member

rth commented Jul 18, 2018

Closing as fixed. Please use 0.19.2 with Python 3.7.

@marco-c
Copy link

marco-c commented Dec 19, 2018

What is the plan for 0.20.X? It looks like I can build with 0.20.0, but not with 0.20.1.
The errors are like:

     sklearn/cluster/_hierarchical.cpp:24792:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
           tstate->exc_traceback = *tb;

@lesteve
Copy link
Member

lesteve commented Dec 19, 2018

Have you tried updating Cython as mentioned in #11320 (comment)?

@marco-c
Copy link

marco-c commented Dec 19, 2018

Just updated to 0.20.2 and it's working.

@nok
Copy link
Contributor

nok commented Jul 21, 2019

I made the experience that all versions lower than 0.20 (e.g. 0.16, 0.17, 0.18, 0.19) will break.

My tests: https://travis-ci.org/nok/sklearn-porter/builds/561765760

Are there any plans to cover these versions?

@rth
Copy link
Member

rth commented Jul 21, 2019

I made the experience that all versions lower than 0.20 (e.g. 0.16, 0.17, 0.18, 0.19) will break.
Are there any plans to cover these versions?

I don't think so. Users with Python 3.7 would need to upgrade to scikit-learn 0.20.X at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests