Skip to content

[WIP] setup.py: Fix numpy installation - #4332

Closed
saketkc wants to merge 0 commit into
scikit-learn:masterfrom
saketkc:master
Closed

saketkc wants to merge 0 commit into
scikit-learn:masterfrom
saketkc:master

Conversation

@saketkc

@saketkc saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor

Pass build_requires if numpy is not found
Fixes #4164

Runs:

  • Doing pip install .
/scikit-learn$ pip install .
Unpacking /media/data1/Development_Version_Controlled/OpenSource/saketkc/forks/scikit-learn
  Running setup.py (path:/tmp/pip-ekp_12-build/setup.py) egg_info for package from file:///media/data1/Development_Version_Controlled/OpenSource/saketkc/forks/scikit-learn
    Partial import of sklearn during the build process.

Downloading/unpacking numpy>=1.6.2 (from scikit-learn==0.16.dev)
  Downloading numpy-1.9.2.tar.gz (4.0MB): 4.0MB downloaded

  • python setup.py build
scikit-learn$ python setup.py build
Partial import of sklearn during the build process.
[Error] Numpy is required to setup scikit-learn
Please install numpy from http://numpy.org

@saketkc

saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Travis would required a re-trigger.

@amueller amueller added this to the 0.16 milestone Mar 4, 2015
@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

I guess we should then add a CI build that just tries to pip-install from scratch? @ogrisel what do you think?

@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

When I do
pip install git+https://github.com/saketkc/scikit-learn.git
I get

    Partial import of sklearn during the build process.

    [Error] Numpy is required to setup scikit-learn

    Please install numpy from http://numpy.org

Which I guess is not the desired behavior?

@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

Hum actually it shows

Collecting numpy>=1.6.2 (from scikit-learn==0.16.dev0)
  Using cached numpy-1.9.2.tar.gz
    Running from numpy source directory.

Not sure what that means...

@saketkc

saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

@amueller Fixed. The behavior is now similar to scipy.

@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

Hm, still not working for me. Oddly it seems to be compiling numpy but then gives me the "no numpy installed" error.
How do you test? I created a fresh virtualenv --no-site-packages and then try to pip install from your branch

@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

I got

[numpy compiling]
Installed /tmp/pip-1IhBst-build/.eggs/numpy-1.9.2-py2.7-linux-x86_64.egg
[...]
Collecting numpy>=1.6.2 (from scikit-learn==0.16.dev0)
  Using cached numpy-1.9.2.tar.gz
    Running from numpy source directory.
Installing collected packages: scikit-learn, numpy
  Running setup.py install for scikit-learn
    Partial import of sklearn during the build process.
    [Error] Numpy is required to setup scikit-learn
    Please install numpy from http://numpy.org

@saketkc

saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Sorry about that, fixing it now.

@saketkc

saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

@amueller I tried fixing it. Not sure if that is the best approach though.

@saketkc

saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Not sure why the build fails. Does it have to do with numpy being at 1.6.1

@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

It failed for all versions of python and numpy....

@amueller

amueller commented Mar 4, 2015

Copy link
Copy Markdown
Member

(Sorry I'm not more helpful at the moment but I am working on other things, too. This might not be super easy to get right.)

@saketkc

saketkc commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Indeed. But I will be on it, once I free myself from other things.

@saketkc

saketkc commented Mar 5, 2015

Copy link
Copy Markdown
Contributor Author

Fixed. I can squash, if everything looks okay.

Comment thread setup.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow pep8: no uppercase here.

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

Works for me now. Please squash.
@ogrisel should we set up a travis that uses pip install scikit-learn to fetch numpy and scipy?
It might take long but I would rather have the installation tested.

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

also +1 for merge.

@amueller amueller changed the title [RFC] setup.py: Fix numpy installation [MRG] setup.py: Fix numpy installation Mar 5, 2015
Comment thread setup.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've had this discussion many times: do we actually want this? This will most likely result in people having numpy build on there system automatically, but without proper linear algebra compiled in it, which will give horrible run times.

I would much prefer a clean error message asking the user to install numpy, but no automatic build of numpy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point brought up is that for continuous integration that is really annoying.
Also, I think breaking will most likely result in the user doing a pip install numpy and then a pip install scikit-learn, which doesn't solve anything.

@GaelVaroquaux

Copy link
Copy Markdown
Member

To answer myself:

This won't solve the problem for installing, because there will be a need for scipy, which is an even bigger difficulty to build.

The discussion in #4164 has come to the conclusion that having scikit-learn pip installable was desirable. I disagree with this conclusion. I can see that some people absolutely want it that way. I think that we should make it an option, but not on by default. Maybe something around the idea of "pip install scikit-learn[all]". So that if you do, as a naive user "pip install scikit-learn", you get a helpful message that points you to a variety of binary (anaconda, but also Christopher Gholke's binaries), and also tell you that if you are sure that you know what you are doing (and are likely to take a very strong performance hit), you can do "pip install scikit-learn[all]".

I feel quite strongly about not automagically installing a broken scikit-learn. I have seen, in the case of numpy, cluster administrators just installing numpy without linear algebra packs. This give a 70 (yes 70) slow down on operations like an SVD. On an HPC cluster, this is just a joke and gives a bad reputation to the Python stack.

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

My virtualenv skills are apparently not good enough to test if this actually succeeds in installing.
I would be ok with having a separate package for continuous integration, but it would make the burden on the release even higher. That obviously only makes sense if it would succeed in installing scipy and numpy from scratch, which, as you point out, might be hard.

Btw, I think you give naive users to much credit when thinking they'll read an informative error message ;)

@GaelVaroquaux

Copy link
Copy Markdown
Member

I would be ok with having a separate package for continuous integration, but it
would make the burden on the release even higher.

No, it's not a separate package. The syntax [foobar] is for optional
dependencies. Ipython does that, for instance.

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

Oh, crazy. I did not know about that.

@GaelVaroquaux

Copy link
Copy Markdown
Member

I think that it would be a way of compromising and making as many people
happy as possible. It would cover the needs of CI (provided that the
build of scipy doesn't crash ;) ), but it wouldn't propagate to
everybody.

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

👍 on that.

@amueller amueller removed this from the 0.16 milestone Mar 5, 2015
@amueller amueller changed the title [MRG] setup.py: Fix numpy installation [WIP] setup.py: Fix numpy installation Mar 5, 2015
@saketkc

saketkc commented Mar 5, 2015

Copy link
Copy Markdown
Contributor Author

Doing a pip install scikit-learn[all] would handle numpy, but I don't think there an equivalent way to do it the python setup.py build[all] way?

Should setup.py simply throw an error if numpy is not found, on either doing a pip install or a python setup.py to have uniformity?

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

Yes, I think it should uniformly throw an error.
Btw, did you try installing scipy, too?

@saketkc

saketkc commented Mar 5, 2015

Copy link
Copy Markdown
Contributor Author

Actually, no. I didn't. I should setup a small travis setup with virtualenv

@amueller

amueller commented Mar 5, 2015

Copy link
Copy Markdown
Member

That would be helpful, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't setup.py install without numpy

4 participants