Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create process using '...\python.exe' | error in virtual environment

I'm unable to use Python within the virtual environment. Python works fine outside of the virtual environment. I'm using Python 3.10.2

I keep on getting the error below when trying to run any Python commands.

`C:\Users\User\AppData\Local\Programs\Python\Python310\python.exe`

It might be relevant to mention that I was unable to create the virtual environment through the python -m venv env command. Error generated was

Error: Command '['C:\\Users\\User\\Documents\\Python Projects\\PDFtoText\\env\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 101.

I had to add without-pip to the end of the command to create the virtual environment. Weird thing is, I was able to use pip within the virtual environment without having to manually install it.

The path to Python is in the environmental variables.

I tried reinstalling Python but that did not help.

Lastly, all these errors started occurring after I downloaded Visual Studio Community 2022.

like image 414
Malkhafa Avatar asked Jul 10 '26 05:07

Malkhafa


1 Answers

Short answer, I bet you have a space in your Window's account name (say Your Account is where your account is saved so you have C:\Users\Your Account folder, and there is also a text file C:\Users\Your ("Your" being the first part of your user name). MSVS2022 (maybe earlier versions, too) is known to leave this log file which exposes a bug in Python venv's python launcher. Delete this text file, and your problem should be solved.

See my question/answer for more details.

like image 176
kesh Avatar answered Jul 11 '26 19:07

kesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!