Repository navigation
Labels
Milestone
Description
Description
pip install scikit-learn --no-binary :all: fails to install scikit because of missing cython build dependency. Once cython is installed manually the above command works and installs scikit-learn.
Steps/Code to Reproduce
pip install scikit-learn --no-binary :all:
it's also the case for python implementations that don't have scikit-learn wheels available (PyPy3, Python3.8)
Expected Results
scikit-learn installs successfully
Actual Results
Running setup.py install for scikit-learn ... error
Complete output from command /home/user/pypy3-venv/bin/pypy3-c -u -c "import setuptools, tokenize;__file__='/var/tmp/pip-install-zf4xear5/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 /var/tmp/pip-record-k9u2qwff/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/pypy3-venv/include/site/python3.6/scikit-learn:
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/tmp/pip-install-zf4xear5/scikit-learn/setup.py", line 290, in <module>
setup_package()
File "/var/tmp/pip-install-zf4xear5/scikit-learn/setup.py", line 286, in setup_package
setup(**metadata)
File "/home/user/pypy3-venv/site-packages/numpy/distutils/core.py", line 137, in setup
config = configuration()
File "/var/tmp/pip-install-zf4xear5/scikit-learn/setup.py", line 174, in configuration
config.add_subpackage('sklearn')
File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1035, in add_subpackage
caller_level = 2)
File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1004, in get_subpackage
caller_level = caller_level + 1)
File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearn/setup.py", line 62, in configuration
config.add_subpackage('utils')
File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1035, in add_subpackage
caller_level = 2)
File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1004, in get_subpackage
caller_level = caller_level + 1)
File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearn/utils/setup.py", line 8, in configuration
from Cython import Tempita
ModuleNotFoundError: No module named 'Cython'
----------------------------------------
Command "/home/user/pypy3-venv/bin/pypy3-c -u -c "import setuptools, tokenize;__file__='/var/tmp/pip-install-zf4xear5/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 /var/tmp/pip-record-k9u2qwff/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/pypy3-venv/include/site/python3.6/scikit-learn" failed with error code 1 in /var/tmp/pip-install-zf4xear5/scikit-learn/
Versions
Reacted by Martin K. Scherer, Krzysztof Kozmic, dylanharpertp, georgechen1, Vladimir and Greg Gompers
Activity
lesteve commentedon Oct 19, 2019
Indeed I can reproduce.
I seem to remember we included the .c files (generated from the Cython files) in the .tar.gz for source distribution (
sdist). Maybe the problem is that we still go through the Cython route, even if we already have the .c files ... this needs to be double-checked.jvesely commentedon Dec 9, 2019
Hi @rth, @lesteve,
this issue still appears in 0.22. I think #15567 rendered changes in #15313 uneffective, and the cython dependency is still required.
should I open a new issue, or can you reopen this one?
rth commentedon Dec 9, 2019
Thanks for reporting this!
Yes, makes sense.
jeremiedbb commentedon Dec 9, 2019
Indeed, but we made cython a build dependency for scikit-learn. So from 0.22, if you pip install with the no-binary flag, you need cython.
jvesely commentedon Dec 9, 2019
I understand that. It'd be nice if scikit-learn declared the build dependencies so that pip can install them automatically[0] rather than expecting the user to install it manually ahead of time.
[0] https://packaging.python.org/specifications/declaring-build-dependencies/
jeremiedbb commentedon Dec 9, 2019
We decided to not use pyproject.toml for this release because we didn't have time to test it properly before the release (you can see related discussion in #15567 and #15533). It's planed to add this for the next release
jvesely commentedon Dec 9, 2019
thanks! Those are both closed/merged. Is there an open issue/pr that tracks this?
jeremiedbb commentedon Dec 9, 2019
Let's keep this one open to track this
adrinjalali commentedon Dec 12, 2019
why is this a blocker for 0.22.1? Are we going to have a
pyproject.toml? I think this takes a while to fix and we shouldn't block the bug-fix release because of it.jnothman commentedon Dec 12, 2019
Sorry, didn't see it tagged blocker. When it was reopened it was tagged 0.22
adrinjalali commentedon Dec 12, 2019
This also seems to be moving to the scipy org, which will make writing a
pyproject.tomleasier: https://pypi.org/project/oldest-supported-numpy/jackjansen commentedon Dec 24, 2020
I have the feeling this bug 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
ModuleNotFounderror 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.
adrinjalali commentedon Dec 30, 2020
@jackjansen we'll need more context to re-open this issue. We do have a
pyproject.tomlfile in whichCythonis a declared build dependency, so I'm not sure what the issue is on your side.jackjansen commentedon Dec 30, 2020
@adrinjalali no need to reopen. The issue has been solved, see #19068.
workaround for sklearn bug scikit-learn/scikit-learn#15298
Install scikit-learn version other than 0.24.0. Workaround for scikit…