You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Undeclared build dependency on Cython (regression of #15298) #19068
I have the feeling issue #15298 has re-appeared with release scikit-learn 0.24.
As of a few days ago I see CI/CD builds failing for a project that has a deep indirect dependency on scikit-learn, with the ModuleNotFound error reported above. Sorry, I don't even know which package has the dependency on scikit-learn...
I can tell you the CI/CD machine runs Python 3.6 on Ubuntu 18.04.
In the mean time I have found out that I use open3d which uses sklearn which uses scikit-learn. The last dependency is unversioned, so I'm now pre-installing "scikit-learn>=0.23,!=0.24.0".
That workaround works for my problem at hand (installing 0.23.3), which I guess shows that my feeling that this problem was correct.
It seems that the source is downloaded instead of a wheel. It explains why scikit-learn try to import Cython because the install would require to build scikit-learn from the source.
@tibco-slolla Could you be more explicit: basically how scikit-learn was intended to be installed and what is the full traceback such that we can know what is indeed happening.
@glemaitre, sure. I am trying to install scikit-learn 0.24.1 on Python 3.6.8 using: pip3 install scikit-learn==0.24.1 --user
I encounter " ModuleNotFoundError: No module named 'Cython'" caused by " ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.".
> Collecting scikit-learn==0.24.1
> Using cached https://files.pythonhosted.org/packages/f4/7b/d415b0c89babf23dcd8ee631015f043e2d76795edd9c7359d6e63257464b/scikit-learn-0.24.1.tar.gz
> Requirement already satisfied: numpy>=1.13.3 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
> Requirement already satisfied: scipy>=0.19.1 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
> Requirement already satisfied: joblib>=0.11 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
> Requirement already satisfied: threadpoolctl>=2.0.0 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
> Installing collected packages: scikit-learn
> Running setup.py install for scikit-learn ... error
> Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-butscc67/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-sr0oc4ux-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
> Partial import of sklearn during the build process.
> Traceback (most recent call last):
> File "/tmp/pip-build-butscc67/scikit-learn/sklearn/_build_utils/__init__.py", line 27, in _check_cython_version
> import Cython
> ModuleNotFoundError: No module named 'Cython'
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/tmp/pip-build-butscc67/scikit-learn/setup.py", line 306, in <module>
> setup_package()
> File "/tmp/pip-build-butscc67/scikit-learn/setup.py", line 302, in setup_package
> setup(**metadata)
> File "/home/jsmith/.local/lib/python3.6/site-packages/numpy/distutils/core.py", line 135, in setup
> config = configuration()
> File "/tmp/pip-build-butscc67/scikit-learn/setup.py", line 186, in configuration
> _check_cython_version()
> File "/tmp/pip-build-butscc67/scikit-learn/sklearn/_build_utils/__init__.py", line 30, in _check_cython_version
> raise ModuleNotFoundError(message) from e
> ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.
@alfaro96 was faster :). Indeed, we need to know about your platform to understand why no wheel was fetched for the install (a wheel will avoid recompiling scikit-learn and thus Cython is not required).
As I see this happening in a CI/CD I can tell you that everything worked a week ago and does not work now.
The culprit seems to be the release of 0.24.1: my carefully crafted requirements.txt has scikit-learn!=0.24.0,>=0.23, which used to resolve to 0.23.2 but now resolves to 0.24.1.
An additional note: using pip>=19.3 should allow fetching the manylinux2010 wheel. We are going to upload the manylinux1 wheels but you could check on your side which version of pip do you work with.
Activity
glemaitre commentedon Dec 24, 2020
Could you paste the traceback of the install?
jackjansen commentedon Dec 24, 2020
scikit-learn-install-log.txt
jackjansen commentedon Dec 24, 2020
In the mean time I have found out that I use open3d which uses sklearn which uses scikit-learn. The last dependency is unversioned, so I'm now pre-installing
"scikit-learn>=0.23,!=0.24.0".That workaround works for my problem at hand (installing 0.23.3), which I guess shows that my feeling that this problem was correct.
glemaitre commentedon Dec 24, 2020
You should not install scikit-learn via
pip install sklearnbutpip install scikit-learn. This would need to be corrected in theopen3dI assume.It seems that the source is downloaded instead of a wheel. It explains why
scikit-learntry to importCythonbecause the install would require to buildscikit-learnfrom the source.glemaitre commentedon Dec 24, 2020
So the good news (at least for us) is that the Cython
ModuleErroris indeed properly raised.alfaro96 commentedon Dec 29, 2020
Closing as the original issue seems to be solved: isl-org/Open3D-ML#200.
tibco-slolla commentedon Jan 19, 2021
This issue does not appear to be resolved in 0.24.1.
glemaitre commentedon Jan 19, 2021
@tibco-slolla Could you be more explicit: basically how scikit-learn was intended to be installed and what is the full traceback such that we can know what is indeed happening.
tibco-slolla commentedon Jan 19, 2021
@glemaitre, sure. I am trying to install scikit-learn 0.24.1 on Python 3.6.8 using: pip3 install scikit-learn==0.24.1 --user
I encounter " ModuleNotFoundError: No module named 'Cython'" caused by " ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.".
alfaro96 commentedon Jan 20, 2021
pipis installingscikit-learnfrom source.Can you provide the output of the following snippet:
glemaitre commentedon Jan 20, 2021
@alfaro96 was faster :). Indeed, we need to know about your platform to understand why no wheel was fetched for the install (a wheel will avoid recompiling scikit-learn and thus Cython is not required).
tibco-slolla commentedon Jan 20, 2021
@glemaitre, @alfaro96: here you go.
jackjansen commentedon Jan 21, 2021
The problem has also re-appeared for me (OP).
As I see this happening in a CI/CD I can tell you that everything worked a week ago and does not work now.
The culprit seems to be the release of 0.24.1: my carefully crafted
requirements.txthasscikit-learn!=0.24.0,>=0.23, which used to resolve to 0.23.2 but now resolves to 0.24.1.Python 3.6 on Ubuntu 18.04.
alfaro96 commentedon Jan 25, 2021
The issue may be resolved by #19235.
glemaitre commentedon Jan 25, 2021
An additional note: using
pip>=19.3should allow fetching themanylinux2010wheel. We are going to upload themanylinux1wheels but you could check on your side which version ofpipdo you work with.Another workaround for scikit-learn/scikit-learn#19068
build: add basic GitHub Action
build: add basic GitHub Action