ImportError: No module named virtualenv ImportError: No module named virtualenv python python

ImportError: No module named virtualenv


Install virtualenv using pip install virtualenv.If you have it already installed, try reinstalling it by removing it with pip uninstall virtualenv and then reinstalling it. Good Luck.


I had to install virtualenv with the -H flag to set HOME variable to target user's home dir.

sudo -H pip install virtualenv


I think the problem is you need sudo to globally install virtualenv.

> pip install virtualenvCould not find an activated virtualenv (required).> sudo pip install virtualenvDownloading/unpacking virtualenv...

But this creates files readable only by root (depending on the umask).In this case, uninstalling/reinstalling may not always help.

You can check with ls -la /usr/local/lib/python2.7/dist-packages/virtualenv.py (replacing 2.7 with whatever version you have or are targeting).

My solution was simply:

sudo chmod -R o+rX /usr/local/lib/python2.7