Comments (22)
There was a new report of this issue. The issue is #272.
from pip.
The suggestion made here (installing each package fully before moving on to the next package) is not an option. One of the core advantages of pip over easy_install is "look before you leap" - pip ensures that all dependencies can be found, unpacked, and have working setup.py before it installs any of them. This avoids leaving the system in a half-broken state when an error is hit after three-quarters of the requirements have already been installed.
This does cause an issue when one package depends on another package in order to even run its setup.py. Really, this is a broken setup.py, and should be fixed in scipy.
For a workaround in pip, the idea presented in #272 is the only one I've seen so far that I think might be an ok option -- allowing some kind of per-line marker in a requirements file that means "install this in a separate first round of installs". I'm not sure I like this, because it feels like going down the road of turning requirements files into a mini-scripting-language for pip, and I'm not sure we want to go that way. But if someone actually turned this proposal into a patch, I'd be interested in seeing how it looks.
from pip.
Hi Carl,
I agree with not adding this kind of behavior to pip. Now I see if we do it or stuff like this, we are not fixing the right place, but only hiding the real problem.
Maybe SciPy folks don't know about this problem... It would be good to send them an email talking about this issue.
I would not like to do it these days. Can someone do it?
from pip.
Thanks for the response ... this makes sense to me. I have raised a ticket on scipy
http://projects.scipy.org/scipy/ticket/1429
In the meantime I simply split my requirements file in two and ran pip twice. Not too arduous!
from pip.
@carljm: this is not a bug in scipy: scipy setup.py requires numpy, that is numpy is a build dependency of scipy. This problem is inherent to any package which requires another package to build - without pip supporting this, there is nothing we can do in scipy to solve this.
from pip.
Hi David,
scipy setup.py requires numpy, that is numpy is a build dependency of scipy.
The two clauses there are not equivalent. A build dependency is not the same thing as a running-setup.py dependency.
Even if scipy requires numpy to build, it still should not require it unconditionally in setup.py -- it should be possible to get package metadata out of setup.py (which is all pip is doing here) without having numpy available.
That said, I see your point that even if that were fixed, the scipy install would still fail, just later on at the build phase.
The only currently-available means for explicitly expressing a build dependency in Python packaging is setuptools' "setup_requires" keyword, which pip already supports. I understand that using setuptools and setup_requires may not be feasible for scipy, but I'm not sure what else pip can or should do to support this case.
Closing this bug -- it's clear that serial installation is the only answer here, and I'm not convinced that pip's requirements file format should be extended to support multiple serial installation within a single requirements file. What we really need is a standard way to express build dependencies in Python packaging - I'll inquire on the distutils2 mailing list about that.
from pip.
Actually, I think if scipy really only had a build dependency on numpy, rather than an importing-setup.py dependency, it would work fine in pip, as long as numpy was listed above scipy in requirements.txt. We don't separate build and install steps, and IIRC current pip versions now process installations in order, so if the egg_info step for scipy could succeed, numpy would be installed before pip tries to build/install scipy.
from pip.
I don't understand the distinction you make between setup.py dependency vs build dependency. setup.py is used to build scipy, and the setup.py certainly needs to import numpy.distutils for monkey patching to work. This is not particular to scipy, but will be the same for any package requiring distutils extensions provided by 3rd party tools (starting from setuptools, BTW).
from pip.
@cournape - setup.py is used to build scipy, but it is not only used to build scipy. It is also used for much simpler things, such as e.g. discovering the version of scipy via "python setup.py --version". What pip is doing ("python setup.py egg_info") is simply an extended version of that: metadata discovery.
Scipy should not require an external package in order to make its core metadata discoverable via setup.py. The import of numpy.distutils should be conditional on the use of a setup.py command (e.g. build or install) that actually requires it.
from pip.
Scipy should not require an external package in order to make its core metadata discoverable via setup.py. The import of
numpy.distutils should be conditional on the use of a setup.py command (e.g. build or install) that actually requires it.
Then you would have the setup script look at sys.argv? It would be messy.
from pip.
Then you would have the setup script look at sys.argv? It would be messy.
Yes, it sure would be messy. Packaging is hard - this is why we are
moving to static metadata in d2 :-) But it's better than having a
package which can't even construct its own metadata without external
dependencies. There's no reasonable workaround pip can be expected to
make in this case.
from pip.
Someone can try to add more hacks to our distutils extensions if they want to support this.
This (and many other things) will go away once we use our own packaging infrastructure in scipy, so I am not really interested in adding more workaround for distutils limitations.
from pip.
Would it not be possible to have an option to make pip install packages sequentially for problematic cases? Note that I'm not suggesting that it be the default behavior, but more the equivalent of --force
or something like that that only people who know what they are doing will use?
from pip.
@astrofrog Not inherently opposed to that, feel free to work on an implementation and see what it looks like.
from pip.
FYI: Just proposed a change in setup.py in scipy: scipy/scipy#453
Hopefully they will accept it. For now using my branch.
Without this fix, it's really annoying to work with tox, when scipy is in requirements.
from pip.
What about a more helpful error response that recommends to manually install dependencies and then run through requirements.txt a la http://stackoverflow.com/a/11015904/1445241
from pip.
mattsenate: To show this message pip will need to parse ImportError exception output from python setup.py egg_info
command it executes - this may lead to suppressing issue of misspelled module name and some other caveats.
If the world was perfect - everybody would not import external modules if egg_info command is executed.
from pip.
I want to second what @wrought said. I got bitten here - maybe you could just print a hint that this might be the issue and re-raise the exception?
EDIT: is it enough to check for 'build', 'build_ext', 'install' in sys.argv and only for these cases import from dependencies?
from pip.
@bjodah It's better to handle egg_info, clean and help commands as special case (at least this is what has been done in scipy (https://github.com/scipy/scipy/blob/master/setup.py) and some other libraries that depend on numpy):
if '--help' in sys.argv[1:] or \
sys.argv[1] in ('--help-commands', 'egg_info', 'clean', '--version'):
...
else:
import numpy
...
from pip.
Was this ever fixed? I'm having the same issue when trying to install scipy from the requirements file using wheel...
from pip.
Robert Griesmeyer (2016/03/03 15:56 -0800):
Was this ever fixed? I'm having the same issue when trying to install
scipy from the requirements file using wheel...
No idea, sorry.
from pip.
I don't think this needs fixing on pip's end.
Package should declare their setup_requires
and/or users should either provide them or expect setuptools to do so.
from pip.
Related Issues (20)
- Installation error for package with un-normalized extra names in pip 24.1b1 HOT 10
- Possible to configure "truststore" to be persistent? HOT 5
- pip does not work with development versions of CPython due to parse error on version string HOT 6
- ModuleNotFoundError: No module named 'pip' HOT 2
- Command - pip reset HOT 6
- python -m ensurepip doesn't create the pip.exe shortcut on python-3.13.0b1 HOT 2
- installing via "git+file" fails under Windows when url point to different drive-letter HOT 1
- Pip >22.2.2 fails to install package from a proxy mirror of PyPI, but can do so directly from PyPI HOT 9
- "No module named 'Cython'", but only when installing a package and only with pip 23.1 or later HOT 2
- ERROR: Fatal Internal error [id=1] HOT 4
- Improve the release process to enable trusted publishing HOT 1
- Improve UX and Performance of Install step HOT 6
- Show the detailed error when facing invalid requirements HOT 6
- pip-24.1b1 doesn't tolerate anymore a contraint like 'python-hdf4>=0.10.0+dummy' HOT 5
- pip --no-input will still prompt for git and ssh
- Ongoing CI issues on `main` HOT 8
- pip install error any package, but can work HOT 1
- Suggest a pip upgrade on UnsupportedWheel if the upgrade check is disabled HOT 3
- Installing dependencies from `pyproject.toml` in the Docker build phase takes very long HOT 6
- Autocomplete failures should not be fatal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pip.