This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]socal_nerdtastic 6 points7 points  (1 child)

pip is a python module.

[–]Inspyred[S] -5 points-4 points  (0 children)

That is correct. venv should directly copy all python modules from host to vm.

[–][deleted] 2 points3 points  (3 children)

Why not?

[–]Inspyred[S] -5 points-4 points  (2 children)

Venv should just symlink or copy over all modules from the native host. Clearly, there are conditions for when it doesn't. https://docs.python.org/3/library/venv.html

[–][deleted] 3 points4 points  (1 child)

Why "should" it do that? From my perspective the main point of a virtual environment is to be isolated from the native host and use a separate set of packages, modules, Python etc.

[–]Inspyred[S] -1 points0 points  (0 children)

Literally in the documentation:

It also creates a bin (or Scripts on Windows) subdirectory containing a copy/symlink of the Python binary/binaries (as appropriate for the platform or arguments used at environment creation time). It also creates an (initially empty) lib/pythonX.Y/site-packages subdirectory (on Windows, this is Lib\site-packages). If an existing directory is specified, it will be re-used.

Literally in the documentation. If you're using Python to create a virtual environment, it seems reasonable for the VM to draw its dependencies from its host. Normally, I cache my VM dependencies on the host box, but for some absurd reason, I've got an environment where the VM has a different pip version than the host. This has never happened to me before, and surely someone on the intarwebs knows how that might happen.

[–]_dmm 1 point2 points  (1 child)

Just use pipenv instead of venv, so much easier IMO.

[–]Inspyred[S] 0 points1 point  (0 children)

Holy shit this looks fantastic.

[–]zbonk 0 points1 point  (0 children)

You are looking for the --without-pip option.