Open OmerFI opened 2 years ago
@uranusjr said the following about the activate.bat
file in Discord:
Note this also seems to be an issue powershell:
C:\Users\<user>\<project>> .\.venv\Scripts\Activate.ps1 -Verbose
VERBOSE: Activation script is located in path: 'C:\Users\<user>\<project>\.venv\Scripts'
VERBOSE: VenvExecDir Fullname: 'C:\Users\<user>\<project>\.venv\Scripts
VERBOSE: VenvExecDir Name: 'Scripts
VERBOSE: VenvDir not given as a parameter, using parent directory name as VenvDir.
VERBOSE: VenvDir=C:\Users\<user>\<project>\.venv
VERBOSE: Given ConfigDir=C:\Users\<user>\<project>\.venv, obtain values in pyvenv.cfg
VERBOSE: File exists, parse key = value lines
VERBOSE: Adding Key:
'home'='C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_<instance>'
VERBOSE: Adding Key: 'include-system-site-packages'='false'
VERBOSE: Adding Key: 'version'='3.10.7'
VERBOSE: Prompt not specified as argument to script, checking pyvenv.cfg value
VERBOSE: Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)
VERBOSE: Got leaf-name of C:\Users\<user>\<project>\.venv='.venv'
VERBOSE: Prompt = '.venv'
VERBOSE: VenvDir='C:\Users\<user>\<project>\.venv'
VERBOSE: Setting prompt to '.venv'
(.venv) PS C:\Users\<user>\<project>> echo $PATH
(.venv) PS C:\Users\<user>\<project>> echo $VIRTUAL_ENV
(.venv) PS C:\Users\<user>\<project>> echo $HOME
C:\Users\<user>
this was causing an issue where pip was failing to install any c++ dependencies because of an incorrect include path. ps that unterminated string was part of the output, not a formatting issue
PR welcome.
Hi,
I'm on a Windows 10+powershell+python from Microsoft Store and I have the same behavior.
Powershell syntax for displaying an environment variable is echo $env:PATH
. You missed out the env:
.
@pfmoore true, thanks!
Issue
Windows PATH environment variable is not set correctly
Description
I have created a virtualenv using this command on Windows:
virtualenv venv
and I activated it:venv\Scripts\activate.bat
The full path of the virtualenv is this:
C:\Users\omerg\Desktop\Ömer\venv
But when I try to use pip, the system uses global pip installed on
C:\Python310\lib\site-packages\pip
instead ofC:\Users\omerg\Desktop\Ömer\venv\Scripts\pip
I am investigating, what I found is that the PATH environment variable is not set correctly.
My
venv\Scripts\activate.bat
is something like this:But when I try to echo the VIRTUAL_ENV or PATH environment variable I am seeing this
But when I try to set VIRTUAL_ENV env var manually, there is no problem
Environment
Output of the virtual environment creation
Make sure to run the creation with
-vvv --with-traceback
: