Bill Noble
Bill Noble

Reputation: 6744

Pip installing to wrong virtual environment

I have two Django projects each with a virtual environment called myvenv. I am trying to use pip to install a package called psycopg2. It is installing to the wrong virtual environment even though the which pip command confirms that pip is being run within the correct virtual environment.

I rebooted my mac so as to start without any virtual environments running. My terminal log looks like this when I try to use pip:

BillMacBookPro:~ billnoble$ cd ~/documents/yhistory-server
BillMacBookPro:yhistory-server billnoble$ source ~/documents/yhistory-    server/myvenv/bin/activate
(myvenv) BillMacBookPro:yhistory-server billnoble$ which pip
/Users/billnoble/Documents/YHistory-Server/myvenv/bin/pip
(myvenv) BillMacBookPro:yhistory-server billnoble$ brew install postgresql
Warning: postgresql-9.4.4 already installed
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
(myvenv) BillMacBookPro:yhistory-server billnoble$ pip install psycopg2
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /Users/billnoble/Documents/VeeUServer/myvenv/lib/python3.4/site-packages
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I am successfully starting my virtual environment in the YHistory-Server directory and which pip confirms that it is running from this virtual server. However when I run pip it complains that the package is installed in another virtual environment on my computer. Why is it using the wrong path name? How can I make it install in the correct virtual environment?

Upvotes: 3

Views: 3392

Answers (1)

ironfroggy
ironfroggy

Reputation: 8119

I think when you created your second virtualenv you did so with the first already activated, and possibly chained them together. Try to recreate your virtual environments, and when you create the second one make sure you deactivate the first one you created first.

Upvotes: 5

Related Questions