Once activated, environment name doesn't show up
c-poole opened this issue · comments
My normal experience with virtualenv and virtualenvwrapper-win is that when an environment is activated, the name of the environment is listed inside parentheses as part of the prompt in cmd. I seem to be able to activate and deactivate environments as I expect, but this parentheses feature which is really nice for knowing that you're in the environment you expect doesn't seem to be showing up. I've attached a picture illustrating the behavior I'm seeing. The output of pip list changes as I expect when I activate and deactivate the environment, but I simply don't receive the helpful reminder that I'm working in a certain environment. The picture hopefully provides all the information you need about versions of windows, python, etc. I'm happy to provide more info if requested.
Could you run:
workon CsPy3
cdvirtualenv
type Scripts\activate.bat
and verify that it contains the line:
set "PROMPT=(CsPy3) %PROMPT%"
This is a change in virtualenv
itself. It looks like the change happened between 16.7.9 and 20.0.0:
c:\srv\venv> virtualenv --version
virtualenv 20.0.0 from c:\python27\lib\site-packages\virtualenv\__init__.pyc
c:\srv\venv> virtualenv venv2000
c:\srv\venv> venv2000\Scripts\activate.bat
c:\srv\venv> python -c "import sys;print sys.path[-3:]"
['c:\\srv\\venv\\venv2000\\Scripts', 'c:\\srv\\venv\\venv2000', 'c:\\srv\\venv\\venv2000\\lib\\site-packages']
vs.
c:\srv\venv> virtualenv --version
16.7.9
c:\srv\venv> virtualenv venv1679
New python executable in c:\srv\venv\venv1679\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
c:\srv\venv> venv1679\Scripts\activate.bat
(venv1679) c:\srv\venv>
It seems there is a new option --prompt
that needs to be passed to set the prompt-prefix:
c:\srv\venv> virtualenv v2004 --prompt="(v2004) "
created virtual environment in 1299ms CPython2Windows(dest=c:\srv\venv\v2004, clear=False, global=False) with seeder FromAppData pip=latest setuptools=latest wheel=latest app_data_dir=C:\Users\bjorn\AppData\Local\pypa\virtualenv\seed-v1 via=copy
c:\srv\venv> v2004\Scripts\activate.bat
(v2004) c:\srv\venv>
I've uploaded version 1.2.6 which fixes this problem (I would urge everyone to upgrade virtualenv to the latest version since it is very much faster than version 16.)
Just to clarify... the --prompt
flag was there in earlier versions of virtualenv
as well (which made the fix much easier).
I install virtualenvwrapper-win 1.2.6,but the problem still exists.
Can you upgrade virtualenv as well. If that doesn't work, check if adding --prompt
works and copy your session into this ticket. It's hard to tell what is wrong without seeing it (i.e. "it works for me" :-) )