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
At minimum, this could use a better error message. Is it not possible to have a project that depends on sklearn and installs all its dependencies to a virtualenv in a single pass? Must I do one pass to install numpy and everything else, and a second pass just to install sklearn?
$ python setup.py install
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "setup.py", line 154, in <module>
setup_package()
File "setup.py", line 146, in setup_package
from numpy.distutils.core import setup
ImportError: No module named numpy.distutils.core
There are pros and cons for doing it this way for numpy. The pro is that
it probably solves the OPs problem. The con is that more people are going
to be hand compiling numpy instead of installing good packages, and thus
be left with horrible linear algebra package.
My hunch would be to leave it the way it is, but I see the point of the
clever trick used in scipy's setup.py.
Maybe we could make this demo work, but chances are that you would have a
really lousy install of numpy and scikit-learn. The problem is that numpy
wouldn't be linked to good linear algebra packages, unless you know what
you are doing, and you have installed the headers of these before. But
that last operation is much harder than getting the pip/python part right.
Really, you should be building from source only if you know well what you
do. In which case none of this should be a problem.
If you are not an expert, please use prebuild packages. At least this is
my opinion.
This is a serious issue, since virtualenv and pip are really becoming the standard to set up a test or development environment.
How can I run tox-based contiuous integration tests for projects that depend on sklearn then?
I agree that using prebuilt packages provided by a decent Linux distribution is the way for production/real life applications, but CI and automatic tests are required tools too.
scikit-learn should not be installed using "pip install" or setuptools in general, but scikit-learn must be installable that way.
Hum, continuous integration is a good point.
However, the value of the integration is not that high if your production setup is quite different from your CI setup....
I agree that if that is how you produce production binaries, then you are most certainly doing it wrong.
Though I don't agree with @GaelVaroquaux that scikit-learn should tell you which scipy to use. I feel it's scipy's responsibility to make sure scipy is installed in a sane way.
What do you think of using extras_require to make available something like a scikit-learn[pip] that actually includes numpy and scipy under install_requires?
This would preserve the current behavior for most users, but would allow people using a standard virtualenv/pip toolchain to have a way to set up environments including scikit-learn without having to jump through a large number of hoops.
Any progress on this issue? It'd be really great if there was a way to use scikit-learn inside a virtualenv by including it (and whatever versions of numpy/scipy/etc. one wants) in a requirements.txt file. Virtualenvs are a very standard way to deploy applications these days, so this is a pretty common use case.
Since there was a solution under discussion as of a few months ago, maybe it makes sense to reopen the issue at least?
I never got a chance to work on this. I still think it should be possible/straightforward to set up a scikit-learn[pip] extra that has the right dependencies, especially now that pip-tools properly supports extras.
Activity
amueller commentedon Jan 26, 2015
What is your current install setup? Scikit-learn requires numpy and if you install everything together, it should work fine.
GaelVaroquaux commentedon Jan 26, 2015
Agreed.
How are you installing things? If you are compiling from source, you do
need numpy installed.
I would be surprised that scipy behaves different.
amueller commentedon Jan 26, 2015
Scipy does behave differently:
https://github.com/scipy/scipy/blob/master/setup.py#L190
( I think)
GaelVaroquaux commentedon Jan 26, 2015
Hum, interesting.
There are pros and cons for doing it this way for numpy. The pro is that
it probably solves the OPs problem. The con is that more people are going
to be hand compiling numpy instead of installing good packages, and thus
be left with horrible linear algebra package.
My hunch would be to leave it the way it is, but I see the point of the
clever trick used in scipy's setup.py.
bukzor commentedon Jan 26, 2015
Demo:
output:
GaelVaroquaux commentedon Jan 26, 2015
Maybe we could make this demo work, but chances are that you would have a
really lousy install of numpy and scikit-learn. The problem is that numpy
wouldn't be linked to good linear algebra packages, unless you know what
you are doing, and you have installed the headers of these before. But
that last operation is much harder than getting the pip/python part right.
Really, you should be building from source only if you know well what you
do. In which case none of this should be a problem.
If you are not an expert, please use prebuild packages. At least this is
my opinion.
amueller commentedon Jan 26, 2015
You are right, installing this way really is a bad idea in most cases...
douardda commentedon Mar 3, 2015
This is a serious issue, since virtualenv and pip are really becoming the standard to set up a test or development environment.
How can I run tox-based contiuous integration tests for projects that depend on sklearn then?
I agree that using prebuilt packages provided by a decent Linux distribution is the way for production/real life applications, but CI and automatic tests are required tools too.
scikit-learn should not be installed using "pip install" or setuptools in general, but scikit-learn must be installable that way.
David
amueller commentedon Mar 3, 2015
Hum, continuous integration is a good point.
However, the value of the integration is not that high if your production setup is quite different from your CI setup....
amueller commentedon Mar 3, 2015
@douardda can you try if the scipy hack works for you?
That is
But I guess it will be more complicated than that...
amueller commentedon Mar 3, 2015
Hum, our setup.py seems pretty identical to the scipy one, I'm not sure what makes theirs work.
douardda commentedon Mar 4, 2015
Humm, on my jessie laptop, in a fresh virtualenv, "pip install scipy" also fails with a "ImportError: No module named numpy.distutils.core".
setup.py: Fix numpy installation
saketkc commentedon Mar 4, 2015
@douardda Would you want to test out the patch in #4332?
11 remaining items
amueller commentedon May 9, 2015
I agree that if that is how you produce production binaries, then you are most certainly doing it wrong.
Though I don't agree with @GaelVaroquaux that scikit-learn should tell you which scipy to use. I feel it's scipy's responsibility to make sure scipy is installed in a sane way.
trying to get travis to install scikit-learn, but running into this p…
taion commentedon Jan 14, 2016
What do you think of using
extras_requireto make available something like ascikit-learn[pip]that actually includesnumpyandscipyunderinstall_requires?This would preserve the current behavior for most users, but would allow people using a standard virtualenv/pip toolchain to have a way to set up environments including scikit-learn without having to jump through a large number of hoops.
cc @cancan101
amueller commentedon Jan 15, 2016
I think that would be fine.
Raji25 commentedon Mar 3, 2016
from numpy.distutils.core import setup
ImportError: No module named 'numpy'
what have to be done in order to rectify the error?
preinstall numpy, fixing scikit future installs via requirements
timabbott commentedon Jul 7, 2016
Any progress on this issue? It'd be really great if there was a way to use scikit-learn inside a virtualenv by including it (and whatever versions of numpy/scipy/etc. one wants) in a requirements.txt file. Virtualenvs are a very standard way to deploy applications these days, so this is a pretty common use case.
Since there was a solution under discussion as of a few months ago, maybe it makes sense to reopen the issue at least?
taion commentedon Jul 7, 2016
I never got a chance to work on this. I still think it should be possible/straightforward to set up a
scikit-learn[pip]extra that has the right dependencies, especially now that pip-tools properly supports extras.matt-carter commentedon Jul 14, 2016
Seconding @timabbott.
taion commentedon Jul 14, 2016
PR up at #6990. It's a very straightforward change.
eligiblekeng commentedon Aug 29, 2016
Temporary fix by overriding the
installcommand insetup.py:Then run
python setup.py installas usualRe-add numpy to requirements.txt.
Make numpy a build dependency.
Make numpy a build dependency.
Make numpy a build dependency.