0

Im trying to make a virtual enviroment in vs code with this command in powershell:

py -3 -m venv venv

But i get this error message:

Error: Command '['C:\\Users\\Oscar GP\\lololol\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 101.

This makes the enviroment, but in the Scripts folder it doesn't make a activate file. but with this command it makes all the right files:

virtualenv venv

But with that command, it wont activate the venv correctly, and i cant fx use:

pip install flask

if i try installing flask, then i get this error message:

Unable to create process using 'C:\Users\Oscar GP\AppData\Local\Programs\Python\Python310\python.exe "C:\Users\Oscar GP\lololol\venv\Scripts\pip.exe" install flask'

I have latest versions of python and pip. I've tried uninstalling and reinstalling python and i tried the same commands in cmd and powershell.

If it matters execution policy is also unrestricted.

Anyone knows how to fix this?

  • The other errors seem to be ripple effects of the first one. The environment was not properly created, and is basically unusable. Put we can't tell what went wrong without further details. – tripleee Apr 16 '22 at 18:43
  • Does this answer your question? [Returned non zero exit status 101 giving an error when I tried create a Virtual environment](https://stackoverflow.com/questions/61371606/returned-non-zero-exit-status-101-giving-an-error-when-i-tried-create-a-virtual) – alien_jedi Apr 16 '22 at 20:30
  • Others have also put forward a lot of answers. Let me put forward another possibility. Is it possible that your pip version is inconsistent with the python version, resulting in the inability of pip to work normally? – MingJie-MSFT Apr 18 '22 at 03:24

1 Answers1

0

After doing a little research, it seems there are a couple of reasons this may occur. However, someone else seems to have had the most similar problem here before. This may occur after upgrading python versions, in which case run sudo apt install python3.{new_version}-venv where new_version is the latest version of python on your system (or whichever version you are using to develop). Another possible listed solution was to uninstall python, then reinstall, and make sure to click the install for all users option. The last likely solution is to run the command python -m venv --clear --symlinks ./venv to recreate your vent. Hope one of these works out :).

alien_jedi
  • 306
  • 3
  • 11