Virtualenvwrapper can't find my envs folder below my home directory in my path (even though it is in there)

186 Views Asked by At

There are a number of SO and other online posts where people had an issue that virtualenvwrapper can't find 'virtualenv', but in my case, it can't find my local envs folder (/home/myuser/Envs). I don't think my issue is the same thing, but I could be wrong.

I have the following in my .bashrc:

export VIRTUALENVWRAPPER_VIRTUALENV=$HOME/Envs
export WORKON_HOME=$HOME/Envs
export PROJECT_HOME=$HOME/software
export PATH=$PATH:$HOME/Envs
source $HOME/.local/bin/virtualenvwrapper.sh

I edited virtualenvwrapper.sh to echo the PATH just before the error message, and this is the output:

~$ mkvirtualenv test
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/myuser/Envs:/home/myuser/.local/bin
ERROR: virtualenvwrapper could not find /home/myuser/Envs in your path
~$ 

So /home/myuser/Envs is showing in the path. I can run commands like workon and lsvirtualenv without getting an error message, although they don't return anything yet because I don't have any virtual environments at this point.

I'm running Ubuntu 22.04 and Python 3.10 if it makes a difference.

Any suggestions would be most welcome.

1

There are 1 best solutions below

0
DaveB On

Nevermind, I found my issue. VIRTUALENVWRAPPER_VIRTUALENV needs to point to the virtualenv script, not my Envs folder. This modified .bashrc script works:

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
export WORKON_HOME=$HOME/Envs
export PROJECT_HOME=$HOME/software
export PATH=$PATH:$WORKON_HOME:$VIRTUALENVWRAPPER_VIRTUALENV
source $HOME/.local/bin/virtualenvwrapper.sh