Hello Opalstack community:
In case somebody needs this, here is a guide of how I got virtualenvwrapper working in Opalstack.
- Install virtualenvwrapper
I used pip3 install --user virtualenvwrapper
as stated in this post
This command installs the virtualenv library because it's a dependency.
- Create the virtualenv directory
Just a simple mkdir ~/.virtualenvs
but, to be honest, you can call it whatever you prefer.
- Check the virtualenvwrapper directory and the python directory
Execute which virtualenvwrapper.sh
. In my case (and probably almost all cases), it showed ~/.local/bin/virtualenvwrapper.sh
Then, open the python terminal using the python3
command, and execute the following:
import sys
print(sys.executable)
Again, in my case (and probably almost all cases), it showed /usr/bin/python3
- Edit ~/.bashrc and push it to the OS
I used nano but you can use vim or whichever command editor you prefer.
So, I executed nano ~/.bashrc
and added the following lines at the end of the file:
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export PIP_VIRTUALENV_BASE=$WORKON_HOME # Tell pip to create its virtualenvs in $WORKON_HOME.
export PIP_RESPECT_VIRTUALENV=true # Tell pip to automatically use the currently active virtualenv.
source $HOME/.local/bin/virtualenvwrapper.sh
Finally, source ~/.bashrc
in order to load it to the OS.
And that's it. Hope it helps.
Regards.