1

When I try to generate a virtual environment, the following error pops up on Windows 11:

PS C:\programming\tmp> python -m venv venv
Error: Command '['C:\\programming\\tmp\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 101.

I have uninstalled all versions of python I did reinstall python 3.10.1 but the error remains. Based on this post I did try to install it for all users with no success. I also added python to PATH.

My guess is that it is related to pip, since python -m venv --without-pip venv_no_pip works (but I need pip thus this is no good solution).

I would appreciate any hint on what to do since I'm out of ideas.

user7431005
  • 3,899
  • 4
  • 22
  • 49
  • Have you tried updating `pip`? `python -m pip install --upgrade pip` – tevemadar Jan 11 '22 at 17:02
  • Does this answer your question? [Windows Python (<=3.10.2) fails to run \`python -m venv .venv\`](https://stackoverflow.com/questions/71039131/windows-python-3-10-2-fails-to-run-python-m-venv-venv) – tevemadar Mar 08 '22 at 11:36

1 Answers1

0

I encountered the same problem (well, all users install did work on my PC) and found a solution. If your python is installed on a path with a space, check out my self-answer

kesh
  • 4,515
  • 2
  • 12
  • 20
  • This was indeed also the problem on my computer. Surprisingly, it was no problem in the past. – user7431005 Feb 09 '22 at 12:14
  • @user7431005 - right? Some account-specific change in Windows triggers this behavior. I filed a bug report to python, and they acknowledged it. So hopefully it'll get fixed soon – kesh Feb 09 '22 at 15:36