Lots of other threads about similar issues, but none that I could find where quite the same case as mine. So, here goes:
Things I did:
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
Current State:
.bash_profile
export PATH=/usr/local/bin:$PATH export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache export WORKON_HOME=$HOME/.virtualenvs export PIP_VIRTUALENV_BASE=$WORKON_HOME export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
Running mkvirtualenv test
results in:
New python executable in trunk/bin/python Installing setuptools, pip...done. /usr/bin/python: No module named virtualenvwrapper
Manually inspecting '/usr/local/bin' shows that virtualenvwrapper.sh exists
/usr/bin/python
What I've tried:
Any help getting this working would be very much appreciated.
Location of Environments The variable WORKON_HOME tells virtualenvwrapper where to place your virtual environments. The default is $HOME/. virtualenvs . If the directory does not exist when virtualenvwrapper is loaded, it will be created automatically.
virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.
I've managed to get this working after having the same problem you've described here by editing my ~/.bash_profile and adding this:
export WORKON_HOME=$HOME/code/.virtualenvs export PROJECT_HOME=$HOME/code export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' source /usr/local/bin/virtualenvwrapper.sh
Save, close.
then:
$ source ~/.bash_profile
and:
$ mkvirtualenv test
I had the same problem setting up virtualenvwrapper on ubuntu.
I had installed virtualenv, virtualenvwrapper using pip which installed these modules in the site package of python3.5. How did I find that out?
Open your terminal and type
$ pip --version
pip 9.0.1 from /home/clyton/.virtualenvs/test1/lib/python3.5/site-packages (python 3.5)
Then I checked the variable VIRTUALENVWRAPPER_PYTHON
whose value was /usr/bin/python. On your terminal and type
$ ls -l $VIRTUALENVWRAPPER_PYTHON lrwxrwxrwx 1 root root 9 Dec 10 2015 **/usr/bin/python -> python2.7**
As you can see this variable is pointing to python2.7 and you may have installed virtualenv in a different python site package.
So to fix this problem, just add the below line in your bashrc
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.5
NOTE: Set the above value to the python version with which virtualenv was installed. In my case it was python3.5 so I have set that value. How to find out the python version used to install virtualenv? Again type pip --version
in the terminal.
Then open a new shell session and try mkvirtualenv again. This time it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With