-
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
pyproject.toml-based builds lose proxy config for build-dependency installation #6018
Comments
Thanks for filing this! ^>^ |
This is the same basic issue as #5502, where network configuration switches are not being forwarded to the isolated child process. |
I also found out that --no-cache-dir is also not forwarded, or cache dir in general. |
@mjpieters you suggest as a workaround using flag --no-build-isolation. Please say, where/how do I implement that workaround? Forgive my ignorance about .toml files, the section that seems to cause the problem is this one in my case:
The first build step tries to install these but fails in my proxy-afflicted environment. |
We seem to be affected by this issue but it doesn't seem that it has got any traction, given that it's nearly 4 years old. Any ideas when it will be fixed? Thanks |
It’d be awesome if you’d be interested in working on it and submit a pull request! Someone being actively affected is in the best position to debug the issue and test the changes. |
I will be happy to test any potential fixes but I got no idea where the problem is and I am not a hardcore Python developer, I just write some occasional Python. |
To be clear, this is probably going to wait until someone who is affected by the issue (and therefore has an environment that can be used to test potential solutions) can create a PR. None of the pip developers work in an environment where this functionality is needed, so we're dependent on the community for help here. I'll add the "awaiting PR" label to the issue to reflect the position here. |
I will be happy to do a PR but I got no idea where the bug is. Any pointers? |
See the OP's comment:
I don't have much more than that. But please understand that this isn't a simple "find the bug and fix it". There's a question of what command line options should be copied over, should the related |
Update Dec 2022: with suitable options for trusted hosts, pip version 22.3.1 on python 3.9.12 happily installs packages to a virtualenv on my MacOS laptop in my proxy-afflicted network environment. I cannot reproduce the problem that @mjpieters posted in 2018. Please note I have no
And here's the success, I anonymized the proxy server domain name (obvs):
So maybe this is no longer a problem? Happy new year everyone. |
Thanks @chrisinmtown! I'll close this then. :) For posterity, if this is locked and you're hitting this issue, check that you have the latest pip version and, if so, please file a new issue with clear reproduction steps. :) |
@pradyunsg perhaps you could please give this a little more time? I'm only reporting that pip seems to work behind a proxy when invoked properly. The original problem description states that a |
@chrisinmtown Your setup has a local cache so never has to download the requirements. Can you retest without the cache? The proxy was used to download the initial package but the build isolation sandbox never had to use the proxy. I'd move the cache aside rather than clear it; |
It’s not using the cache — pip prints “Using cached …” when it uses the cache. |
FWIW I tried to clear the pip cache before I ran the tests posted above, like this:
Thanks for the directions to use
I then uninstalled
|
Taking a more careful look, this issue is about projects that need to be built via pyproject.toml-based builds, and your example isn't performing such a build; it's using a compatible |
@pradyunsg so the right test to run is installing a Python package "A" that depends on a package "B" for which no pre-built |
You "just" need something that'd get built from source -- passing a source tarball containing a |
Thanks @pradyunsg for the new information. It looks like the proxy config is not preserved, the problem apparently still exists. Here's the output:
|
I tried to follow @mjpieters suggestion that the install_requirements function needs to pass proxy information to the pip subprocess. I don't immediately see a source for that. I added it very crudely at line 265 and then the install of dependencies worked:
I see that the |
Did you try PIP_PROXY env? |
Thanks @q0w for the suggestion. I tried getting the PIP_PROXY environment variable like this without success:
|
No, without modifying pip code? Does it work wit PIP_ env variables |
Yes, setting the
For what it's worth, in my proxy-afflicted environment this install fails if PIP_PROXY is not set or if either trusted-host argument is missing. |
This issue seems to be related to the following discussion: |
One workaround not mentioned in this issue is that pip is using requests for making http calls, so anything that would cause requests to use a proxy will cause pip to use a proxy. E.g. you can set the standard environmental variables |
Environment
Description
When behind a proxy, installing a project with a
pyproject.toml
defining abuild-system.requires
option will fail, because theBuildEnvironment.install_requirements()
implementation runspip
as a child process without copying across proxy configuration.Expected behavior
Even in an isolated build environment, proxy access needs to be configured, so that build dependencies can be downloaded.
How to Reproduce
Block direct access to PyPI, and use a proxy to install
pyinstaller
, e.g.pip install pyinstaller --proxy=http://webdefence.global.blackspider.com:80 --trusted-host=pypi.python.org
.Disabling build isolation with
--no-build-isolation
and manually installing the build requirements first lets you work around this issue.Output
I'm filing this ticket as a follow-up to a Stack Overflow question, where a Windows user ran into this problem. They shared their
pip -vvv
output to help diagnosing.The text was updated successfully, but these errors were encountered: