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

--pypi-mirror not applied during virtualenv creation #2455

Closed
JacobHenner opened this issue Jun 28, 2018 · 4 comments
Closed

--pypi-mirror not applied during virtualenv creation #2455

JacobHenner opened this issue Jun 28, 2018 · 4 comments
Labels
Type: Bug 🐛 This issue is a bug.

Comments

@JacobHenner
Copy link
Contributor

When starting a new project using pipenv with --pypi-mirror specified, virtualenv uses pip without respecting the --pypi-mirror setting.

If PyPI is inaccessible during this process, virtualenv falls back to using local copies of necessary packages and pipenv silently proceeds. However, if connections to PyPI time out (e.g. if packets are dropped instead of rejected by a firewall), pip (and virtualenv) will hang, and pipenv will timeout.

@JacobHenner
Copy link
Contributor Author

I've started working on the fix for this and hope to have it available for review by tomorrow. I intend to set the PIP_INDEX_URL environment variable to the value of --pypi-mirror when calling virtualenv in do_create_virtualenv.

This was not detected during prior testing, as pip/virtualenv will silently fail if connections to pypi fail. However, pip will hang (which will cause pipenv to time out) if connections to pypi hang.

@techalchemy
Copy link
Member

Thanks for digging into this. Do you want to tackle it? Is it a good idea to handle the exception(s)? -- are there any?

If not, should we temporarily set the default pip index while we create the environment?

(I see after typing this that you like the second option, which sounds fine to me)

@techalchemy techalchemy added the Type: Bug 🐛 This issue is a bug. label Jun 28, 2018
@JacobHenner
Copy link
Contributor Author

Yeah, I'll tackle it. I see two options:

  1. If --pypi-mirror is set, pass --no-download to virtualenv.
  2. If it's set, temporarily set the default pip index via environment variable before calling virtualenv. There's no need to refine this behavior further, as all of the packages pip will try to download will necessarily be PyPI packages.

I think 2 is probably more consistent with what the user would expect.

@techalchemy
Copy link
Member

I'm marking our (immediate) bugfix release as 7.0, but really we are gonna get it released whenever we can.

If this is done whenever that is done, we will include it in the bugfix release. If not, no pressure, we can get this in on the next cycle

JacobHenner added a commit to JacobHenner/pipenv that referenced this issue Jun 28, 2018
Adds support for the --pypi-mirror parameter for all operations which
may result in a virtualenv initialization.

When a virtualenv is initialized, pip attempts to download several
dependencies from PyPI. If PyPI is unavailable, virtualenv silently uses
local packages instead, which is acceptable in most cases. However, in
some environments connection attempts to PyPI will stall rather than
fail, causing a pipenv timeout. By using the mirror specified by
--pypi-mirror, we can ensure virtualenv will attempt to download
dependencies from an accessible mirror instead of PyPI.

- Fixes pypa#2455
JacobHenner added a commit to JacobHenner/pipenv that referenced this issue Jun 28, 2018
Adds support for the --pypi-mirror parameter for all operations which
may result in a virtualenv initialization.

When a virtualenv is initialized, pip attempts to download several
dependencies from PyPI. If PyPI is unavailable, virtualenv silently uses
local packages instead, which is acceptable in most cases. However, in
some environments connection attempts to PyPI will stall rather than
fail, causing a pipenv timeout. By using the mirror specified by
--pypi-mirror, we can ensure virtualenv will attempt to download
dependencies from an accessible mirror instead of PyPI.

- Fixes pypa#2455
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 This issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants