Make it possible to use virtualenv directly from .whl/.zip #570

Open
piotr-dobrogost opened this Issue Feb 21, 2014 · 3 comments

Comments

Projects
None yet
3 participants

Would it be possible to make virtualenv work without extracting/installing the same way one can use wheel ($ python wheel-0.21.0-py2.py3-none-any.whl/wheel -h) ?

Owner

pfmoore commented Feb 21, 2014

Not easily, because virtualenv needs the wheels in virtualenv_support to be real files so they can be installed (and so the pip one can be added to sys.path - zipimport doesn't allow zips within zips, as far as I know).

Theoretically, it would be possible to embed virtualenv_support in the virtualenv.py script, and extract to a temporary directory on every use, but (a) it'd be a lot slower, and (b) the gain is minimal.

Member

Ivoz commented Feb 21, 2014

You could A) have it conditional on setuptools being installed, so the pkg_resources could be used to find the files, and B) then extract both the pip & setuptools wheels into the new venv directory before using them (and cleaning them up after).

But it'd be a bit of work.

Note, you can already use only the virtualenv.py in a pretty full featured manner by passing it a directory with the pip & setuptools wheels in it. For instance, what aspen python does atm (they really like vendoring for some reason).

Owner

pfmoore commented Feb 21, 2014

No need for setuptools to extract the files from a zip/whl. The biggest problem (the killer for me) is that it would slow down virtualenv creation drastically.

The supported usage is to have virtualenv.py and virtualenv_support alongside it. No need to install virtualenv (although obviously you can), but running without the support directory is not supported. (We used to support that, downloading from the internet if no local support files were available, but that's a big security hole as well as a nasty slowdown, so we dropped it some time back).

I'm not against someone producing a patch to support one-file running, but it would need to not slow down venv creation before I'd support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment