pip: Could not find an activated virtualenv (required)

Pietro Speroni picture Pietro Speroni · May 9, 2013 · Viewed 29.2k times · Source

I am trying to instal virtualenv and/or virtualenvwrapper on a mac osx 10.8.3

I have been fighting with python for the last two days. Finally I was able to install python 2.7.4 using brew. Before I had virtualenv installed using easy_install. Then I tried to uninstall it, trying to get my computer in the same situation as the one of my colleagues. Maybe I uninstalled it with success, maybe not. I don't know how to test it. Now I am supposed to install virtualenv using -

pip install virtualenv

But it gives me -

Could not find an activated virtualenv (required).

pip install virtualenvwrapper gives exactly the same output.

Also the variable: PIP_RESPECT_VIRTUALENV is null:

echo $PIP_RESPECT_VIRTUALENV

How can I solve this issue?

Thanks

Answer

Bibhas Debnath picture Bibhas Debnath · May 9, 2013

Open your ~/.bashrc file and see if this line is there -

export PIP_REQUIRE_VIRTUALENV=true

It might be causing the trouble. If it's there, change it to false and run -

source ~/.bashrc

If not, run export PIP_REQUIRE_VIRTUALENV=false from terminal.

Note: everything works the same if you have .bash_profile instead of .bashrc in your current user's root directory.