0

On Ubuntu 20.04.4 and python 3.8.10 my virtualenvwrapper installation is broken. When I try

mkvirtualenv  test

I get an error

ERROR: virtualenvwrapper could not find virtualenv in your path

for some reasons I am unable to install virtualenv anymore, as I use

python -m venv myvenv

to create a virtualenv.

Is there some workaround? Maybe create an alias? Anything else?

In other words: How to make virtualenvwrapper work without virtualenv installed? (I am not able to install virtualenv to begin with. So please do not suggest to install that, as it does not work anymore).

Alex
  • 801
  • Now this looks like something unlike the previous question. Ubuntu 20.04 should have python version 3.8.2. AU is littered with questions from users that messed with the python version and ended up reinstalling Ubuntu. https://askubuntu.com/questions/1232812/whats-the-default-python-version-in-ubuntu-20-04 – ChanganAuto Jul 19 '22 at 15:11
  • Maybe someone can create a tool that checks the whole setup and proposes how to fix it – Alex Jul 19 '22 at 15:12
  • For future reference: https://askubuntu.com/questions/1417084/cannot-create-a-virtual-enviroment-with-python-3-8-10-on-ubuntu-20-04 – ChanganAuto Jul 19 '22 at 15:17
  • Can you detail how you installed virtualenvwrapper and/or mkvenv? I tried installing both with pip install virtualenvwrapper and apt install virtualenvwrapper and it works in both cases because both installation methods pull virtualenv as a dependency. – roadmr Jul 19 '22 at 16:37
  • @roadmr Do you really think I write down every command I used to install a tool? I am trying now, but in most cases things don't work as they should be, and I use dozen of commands to install, uninstall, install it differently. I do NOT know how I installed things. I am pretty sure nobody will ever know how someone installed a tool like 2 years back.... – Alex Jul 20 '22 at 05:30

1 Answers1

1

As mentioned in the comments, it's kind of tricky to get virtualenvwrapper installed without installing virtualenv; but by removing virtualenv selectively I was able to replicate your error. With virtualenv unavailable, this works to create virtual environments using python3 -mvenv instead of virtualenv.

VIRTUALENVWRAPPER_VIRTUALENV='python3' VIRTUALENVWRAPPER_VIRTUALENV_ARGS='-mvenv' mkvirtualenv a-funny-name
roadmr
  • 34,222
  • 9
  • 81
  • 93
  • But you didn't change the system's python version, did you? – ChanganAuto Jul 19 '22 at 18:39
  • I did not; used the version that comes with Ubuntu 20.04, which is 3.8.10. The same trick to set the VIRTUALENVWRAPPER variables would work for any version of Python you have installed as long as you point to the right python3 interpreter. – roadmr Jul 19 '22 at 19:04