3

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:

  1. Installing pyenv
  2. Within pyenv, installing python 3.9
  3. Setting 3.9 as the default python in pyenv
  4. initializing my pipenv with pipenv shell 'pyenv which python' (those should be backticks)
Chris Curvey
  • 9,738
  • 10
  • 48
  • 70

2 Answers2

2

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!

Laconic
  • 41
  • 5
  • Indeed, in my case a "broken" installation of python site packages had slipped into `~/.local`, in particular yet another `pip` version. Removing `~/.local/bin` and `~/.local/lib` (after verifying it contained only undesired Python stuff) solved the issue for me. – bluenote10 Jan 01 '23 at 13:24
0

Same issue has occurred to me , I have made a few of command lines on terminal of linux in the following:

  1. pip install --upgrade pip (my pip shown that it was not updated)
  2. pip install --upgrade virtualenv
  3. pip install --upgrade virtualenvwrapper

After the above command lines, and then I tried command "mkvirtualenv" for making new virtualenv and it was successful.