I’ve been using virtualenvwrapper for years, not sure what has changed.
$ mkvirtualenv foobar
created virtual environment CPython3.10.4.final.0-64 in 110ms
creator CPython3Posix(dest=/home/chris/.virtualenvs/foobar, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/chris/.local/share/virtualenv)
added seed packages: pip==22.1.2, setuptools==62.6.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
virtualenvwrapper.user_scripts creating /home/chris/.virtualenvs/foobar/bin/predeactivate
ERROR: Environment '/home/chris/.virtualenvs/foobar' does not contain an activate script.
And that is true — the newly created /home/chris/.virtualenvs/foobar directory doesn’t even have a "bin" directory.
I’ve seen this post, but the fixes there don’t change anything:
Installation fails Virtualenvwrapper and Virtualenvs does not contains an activate script
I’m running Ubuntu 2022.04, fully patched.
UPDATE
I suspect that the issue was caused by conflicts between packages installed via apt get
, sudo pip3 install
, etc. Things are probably not helped by the new pattern of installing packages in .local
. (My system is pretty old and has gone through a lot of OS and Python upgrades.)
In any case, I was able to get this working by:
- Installing pyenv
- Within pyenv, installing python 3.9
- Setting 3.9 as the default python in pyenv
- initializing my pipenv with
pipenv shell 'pyenv which python'
(those should be backticks)
2
Answers
I had the same issue, it creates it in local/bin directory. Move bin up one level and run mkvirtualenv script again. Also you need to change path in ‘pip’ and ‘wheel’ files inside bin.
To pip developers: please don’t touch what’s working!
Same issue has occurred to me , I have made a few of command lines on terminal of linux in the following:
After the above command lines, and then I tried command "mkvirtualenv" for making new virtualenv and it was successful.