-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install install_requires before running python setup.py bdist_wheel #6193
Comments
Note that we still get exactly the same error even by adding
|
setup_requires does not match with PEP-517, so thats not supportable for pip if you need numpy for the build of a package in isolation, use the PEP-517/518 metadata or set up a custom build without isolation |
Few days ago, I opened issue #6144 on PEP-517. I think this PEP (isolated build) is a problem for some packages (and also for compatibility with conda) so many packages won't be able to use it. It's really a problem that the very simple package described in the issue cannot be installed with just one simple pip command. It would be so simple for pip! The numpy wheel is ready. I really don't understand what would be the problem with installing the wheels as soon as they are ready and not to build all wheels and then installing them. Otherwise, why is there the sentence I quoted in https://pip.pypa.io/en/latest/reference/pip_install/#installation-order ? |
build isolation builds things in a completely pristine environment, - its a positive key property for repeatability and comprehension a key need is not having random things affect the state, which seems to be your desire to get as a feature - my personal opinion on that is -- sorry no go, please try again with something reliable |
I really understand that isolation build is very good and useful for most packages. I also think that many good things in Python have been done before without isolation build and that it's not a good idea to force people to use isolation build if you want to impose a new standard (PEP 518, pyproject.toml), but anyway. You also have to understand that there are reasonable reasons to avoid isolation builds (for example compatibility with conda [which is not a small subject in numerical / scientific / data Python], or using packages for which there are no wheels on PyPI, as mpi4py). So simple things have to work without build isolation and pyproject.toml. In particular, things like what I describe in this issue should work. At least, there should have a pip option to get this nice behavior (which is not crazy). It really seems that it is not even technically difficult from the pip point of view. What is the drawback of installing wheels as soon as they are ready? It seems to me that pipenv does it (at least tox-pipenv). Anyway, isolation build won't become the default for package without pyproject.toml. What is the advantage of building the wheels from all collected sdist with the old environment? Also, it would be nice to answer about the sentence at the end of the paragraph https://pip.pypa.io/en/latest/reference/pip_install/#installation-order Is it just wrong? If it is wrong, should it be removed from the documentation? Moreover, why was it included in the official pip documentation if it is a such a terrible practice to rely on non-isolated builds and on the evolution of the environment during the pip command execution? |
The issue is that pip builds the package in an isolated environment where it systematically downloads all those requirements, so the version of numpy used to build the package may mismatch the version of the installed numpy. To prevent this, we could do ``pip install . -v --no-build-isolation`` but then it requires that all build dependencies (cmake, scikit-build) be installed explicitly by the user. By removing numpy here, we only require that the user install numpy before, which is more reasonable IMO. See pypa/pip#6193 pypa/pip#6144
The guarantee is about installation order; not build order. It does not suggest that it would install a I suggest you use PEP 518, or disable isolation with |
Yes it does! 🙂 I'm sure that the last paragraph of https://pip.pypa.io/en/latest/reference/pip_install/#installation-order is really about this issue. From what is written (see my quote in the first message of the issue), the example in this issue should work. It's clear. I have to repeat that PEP 518 ( Using So unfortunately, A simple solution would be that pip installs each wheel that has to be installed just when it is ready (before the next build) and not at the end, when all wheels have been built. What is the problem of doing that? |
|
I know. I try to tell you that there is a problem with the new standard (pyproject.toml / build isolation) of how to declare build dependencies and that it would be good if what is written in the official documentation works. From https://pip.pypa.io/en/latest/reference/pip_install/#installation-order
If there a problem with my English? Why don't you understand me? Isn't it clear that if we take seriously what is written in this paragraph, the example in this issue should work.
I have to admit that I am sad about how my remarks (this issue and issue #6144) are treated. In scientific and data applications, conda is used a lot. My reasoning is that it is not a great thing that the Python community is split in terms of installation tools, so I tried a lot to be also able to work without conda. I thought that pip could also be adapted for our applications. But now, I start to see how concerns from my community are treated by pip core developers. |
Maybe the wording of that document is a little unclear. But the principle is simple:
Those terms are possibly a little confusing (they confuse me!) but they have been standard for many, many years. "They have build dependencies that are also declared as install dependencies using install_requires" means that the project declares that You say that "For whatever reason (in particular because it leads to problems to declare the same package in install_requires and in setup_requires, as already explained above), we don't use setup_requires". That's fine -
All I can say is that we're trying. Personally, I'm struggling to understand what you want and why the approaches that have been suggested to you are so unacceptable. I will say that "because conda needs pip to work like this" is not a compelling argument, at least to me. While I'm 100% in favour of better interoperability between conda and pip, I don't think that will be achieved by simply making pip change "to work with conda". What's needed is a better understanding of the shared requirements of the two ecosystems and how both tools can compromise to make things work better - while still remaining true to their core goals and user communities. 1 It's possible that the setuptools backend is introspecting your |
Let's improve the wording in the documentation. I think that's the reason for the confusion in this case. |
I think that the documentation at https://pip.pypa.io/en/stable/reference/pip_install/#installation-order is pretty clear: it describes a use case that used to work completely fine with the "classical" (not based on wheels) installation. But the same use case no longer works with the "new" (first build wheel, then install from wheel) installation. Unfortunately, See also the discussion at https://discuss.python.org/t/support-for-build-and-run-time-dependencies/1513 |
FYI: the feature of installing Now, I totally understand that it's difficult to support this feature with |
Just to clarify, does this also not work with |
@cjerdonek: The problem is not so much PEP 517, the problem is really So nothing got broken for now (in the sense that packages that used to install still install). But that's only because |
Yes, that was the reason for the fallback: to make sure things could continue working and, I assume, to get a better understanding of what remaining cases may need further thought or discussion (of which this issue is an example). I'm certain there will be ample discussion before the fallback is removed (see #6334 for the anchor issue on this). In asking my question, I just wanted to confirm 19.0.x did have a work-around that was working and wasn't breaking for you entirely. |
I have exactly the same problem as the OP for projects that depend on PyPI's "cmake" package (in Since the install of the "cmake" package finishes "too late", a user will not build a wheel (unless executing "pip install ." twice) for my source packages, although it could if cmake were properly installed before starting to build. Here is the cumbersome logic that is executed:
|
Ok, I should learn to read all comments. Indeed, following PEP-518 and just adding a [build-system]
requires = ["setuptools>38.6", "wheel", "cmake>=3.11.0,<4.0.0"] context will be picked up by |
A clarification has been added to the relevant section (see #6604). Closing this since there isn't much else actionable here since we mostly just needed a clarification here. |
Environment
Description
pip executes
python setup.py bdist_wheel
before installing the packages listed ininstall_requires
.For a simple package depending on numpy, using numpy in setup.py but such that
python setup.py egg_info
works fine without numpy, it shouldn't be necessary to usesetup_requires
(and to have a setup.py compatible withsetup_requires
, which is not easy).From https://pip.pypa.io/en/latest/reference/pip_install/#installation-order
For example, for this
setup.py
and this
setup.cfg
:the command
pip install .
fails withExpected behavior
pip should install numpy before executing
python setup.py bdist_wheel
so that this simple setup works fine as explained in https://pip.pypa.io/en/latest/reference/pip_install/#installation-order.Note
Listing packages both in
install_requires
andsetup_requires
don't work well. See pypa/setuptools#209 and pypa/setuptools#391The text was updated successfully, but these errors were encountered: