Skip to content
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

How can I use pypi-mirror behind a proxy? #13

Closed
tt2000 opened this issue Oct 5, 2021 · 8 comments
Closed

How can I use pypi-mirror behind a proxy? #13

tt2000 opened this issue Oct 5, 2021 · 8 comments

Comments

@tt2000
Copy link

tt2000 commented Oct 5, 2021

If I use pip to download a package, I add --proxy http://proxy.url:port. Is there a similar option for pypi-mirror?

@montag451
Copy link
Owner

Hi @tt2000,

For the moment there is no way to specify a proxy using a command line switch but I will add one since it's something pretty common to be behind a corporate proxy. For the moment, your best shot is to try to specify the proxy using an environment variable (HTTP_PROXY and/or HTTPS_PROXY)

@montag451
Copy link
Owner

montag451 commented Oct 5, 2021

I've added a --proxy option to the download command. Could you test it? If it's OK for you I will publish a new version on PyPI

@tt2000
Copy link
Author

tt2000 commented Oct 6, 2021

How can I test it? Just cloning your master branch and running e. g. python .\pypi_mirror.py download -d test_download --proxy http://proxy.url:1234 numpy throws errors (not sure if related to proxy). Do I have to install it differently? It seems to try to install dependencies:

Collecting numpy
  Using cached numpy-1.21.2.zip (10.3 MB)
  Installing build dependencies ... error

Should it not just download the dependencies instead of installing them?

@montag451
Copy link
Owner

montag451 commented Oct 6, 2021

pypi-mirror uses pip under the hood to download a package and its dependencies. When pip downloads a source distribution (e.g numpy-1.21.2.zip) it runs the setup script of the package to find out the dependencies of the package because source distributions do not have the Requires-Dist field in their metadata file (i.e the PKG-INFO inside the tarball or the zip file, see pypa/setuptools#1805). Setup scripts can do a lot of things and the setup script of numpy is a pretty complicated one. To prevent this kind of things to happen, I strongly advise you to download only binary distribution (i.e wheel files) using the -b option of the download command:

python .\pypi_mirror.py download -d test_download --proxy http://proxy.url:1234 -b numpy

@johnziebro
Copy link

johnziebro commented Oct 6, 2021

Just noting that using the -b flag also allowed mirroring of the osmnx module, which has a complicated install process with pip (considered experimental) and conda installation is generally recommended. Flagging binary also significantly speeds up the process by bypassing local building.

@tt2000
Copy link
Author

tt2000 commented Oct 7, 2021

@montag451 Testing was successful, I can confirm that the new proxy argument works. Thx for the very fast responses and good service!

@montag451
Copy link
Owner

@tt2000 Perfect, I will publish a new version of the package on PyPI. Thx for the bug report and the testing! I will close this issue as soon as the new version is published.

@montag451
Copy link
Owner

I've published a new version on PyPI so I will close this issue. Thx again for the bug report and the testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants