Michael Grazebrook
Michael Grazebrook

Reputation: 5671

python -m venv <envname> fails on Windows

I tried to run:

python -m venv my_venv_name

It fails with this message:

Error: Command '['\\\\ (redacted path) \\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 2.

I have a fresh install of Python 3.6.5 including pip 9.0.3. python -m pip works. The install is user-local and the only Python installation. This is in a corporate environment where pip can't access external stuff (surely it doesn't need to?) It's all in my user area: both the full python install and the venv target directory are on a network drive.

(I've redacted part of the path to Python in the error message)

How can I fix this? Should I report it as a bug? The error message would be confusing for a beginner following the basic tutorial.

Conclusion: Don't work on UNC paths. Map a drive letter.

Upvotes: 2

Views: 1064

Answers (1)

Jacques Gaudin
Jacques Gaudin

Reputation: 16958

The following should work:

python -m venv --without-pip my_venv_name

The options are documented here

Upvotes: 1

Related Questions