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
Another place where you may possibly have this "lock" is the
pip.conf
file. In my case I had one in my~/Library/Application Support/pip
folder and forgot about it.Typical content of the file could be:
Similar to other answers,
false
should be changed totrue
in the file.Open your
~/.bashrc
file and see if this line is there -It might be causing the trouble. If it's there, change it to
false
and run -If not, run
export PIP_REQUIRE_VIRTUALENV=false
from terminal.An additional solution to those already presented is to add a shell command that will allow you to install py packages by temporarily overriding the default setting. Add this to your
~/.profile
,~/.bashrc
or wherever you maintain your shell's exports/settings (in my case,~/.zshrc
).With this simple addition, you can install pip packages to the system via
syspip install <package>
.@Bibhas has it; +1 to look for
export PIP_REQUIRE_VIRTUALENV=true
in~/.profile
or~/.bashrc
. You can confirm the setting in your current shell withenv |grep PIP_REQUIRE_VIRTUALENV
.This setting is a good safety check; more often than not, you'll want to be installing things into virtualenvs. However, sometimes you do want to be working with the global/system python. In those cases, take a look at --isolated:
Verify contents of ~/.pip/pip.conf like:
if previous it was set like require-virtualenv=true