regisf / virtualenvwrapper-powershell

A mimic of the VirtualEnvWrapper project but with Powershell
MIT License
109 stars 28 forks source link

Unable to create process -- #18

Closed readytheory closed 4 years ago

readytheory commented 4 years ago

[Update: the problem I describe here was caused by something corrupt in the directory where I made envorenments. I chaged WORKON_HOME to point to a new, empty, directory and the problem went away]

I was having problems with environments created by "python -m venv" not giving me a working pip, and found virtualenvwrapper-powershell and it worked for me. Sometime last week I had this update from microsoft to Windows 10:

https://support.microsoft.com/en-us/help/4551762/windows-10-update-kb4551762

Could be a coincence, but now old woes are back and show in virtualenvwrapper also:

PS C:\Users\pa2> Get-VirtualEnvVersion
Version 0.2.0
PS C:\Users\pa2> New-VirtualEnv uvula
Creating virtual env...
. : The term 'C:\py\venvs\uvula\Scripts\activate.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\Users\pa2\Documents\WindowsPowerShell\Modules\VirtualEnvWrapper.psm1:105 char:7
+     . $ActivatepPath
+       ~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\py\venvs\uvula\Scripts\activate.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

  SUCCESS: uvula virtual environment was created and your're in.

PS C:\Users\pa2> C:\py\venvs\uvula\Scripts\Activate.ps1
(uvula) PS C:\Users\pa2> pip install requests
Fatal error in launcher: Unable to create process using '"c:\py\venvs\uvula\scripts\python.exe"  "C:\py\venvs\uvula\Scripts\pip.exe" install requests'

I believe problem is that "activate.ps1" and not "Activate.ps1" -- I will try creating symlinks but have been down similar road before with '-m venv' and some other manager. There seems to be something very sensitive about my home pc, have had similar problems with 3.6, 3.7 and 3.8, started whole new user accounts to try to fix.

readytheory commented 4 years ago

An ugly workaround: when "pip.exe" is created in the environment's "Scripts" directory, it gets the lowercse "s" for scripts. I was able to edit pip.exe with a text editor and change "scripts" to "Scripts", then pip worked.... though with a warning about outdated wrapper.

Also, while trying to uninsall pip, I found if I don't get Lib\site-packages in PYTHONPATH, shouldn't that get set?

PS C:\Users\pa2> New-VirtualEnv nerveux
Creating virtual env...
. : The term 'C:\py\venvs\nerveux\Scripts\activate.ps1' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Users\pa2\Documents\WindowsPowerShell\Modules\VirtualEnvWrapper.psm1:105 char:7
+     . $ActivatepPath
+       ~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\py\venvs\nerveux\Scripts\activate.ps1:String) [], CommandNotFoundExc
   eption
+ FullyQualifiedErrorId : CommandNotFoundException

  SUCCESS: nerveux virtual environment was created and your're in.

PS C:\Users\pa2> workon nerveux
(nerveux) PS C:\Users\pa2> echo $env:PYTHONPATH
(nerveux) PS C:\Users\pa2>
regisf commented 4 years ago

HI @readytheory
I have some time today I will investigate. Regards

readytheory commented 4 years ago

I think this can be closed. The problem was something in the directory I used for virtual environments. I changed WORKON_HOME to point to a new, empty directory, and the problem stopped. Someday, I'll look into the old one and see if I can recreate and figure the source.