Search code examples
djangovirtualenvpipeasy-install

virtualenv site packages dir not updating


I am using the virtualenv setup detailed here http://hackercodex.com/guide/python-install-django-on-mac-osx-lion-10.7/ . It worked well on my previous project, and it has install any dependencies inside that env.

Now when I create a new virtualenv, and try install django it says its already installed.

$ easy_install django
Searching for django
Best match: Django 1.4
Django 1.4 is already the active version in easy-install.pth

Using /Users/tharshan/sites/env/django_base/lib/python2.7/site-packages
Processing dependencies for django
Finished processing dependencies for django

I should explain that django_base is the name of another virtualenv which was my previous project.smpmc is the name of my new project. It should be installing the site-packages inside the /Users/tharshan/sites/env/smpmc/lib/python2.7/site-packages folder.

I made sure to deactivate my previous env as well,and activate this one after. I cannot seem to install any packages in this one as it seems to be redirecting all the installs to my old project.

It must be a bug somewhere in the activate scripts?

postactivate

proj_name=${VIRTUAL_ENV##*/}

# Add the active project to the PYTHONPATH
if [ -d ~/Sites/env/$proj_name/lib/python2.7/site-packages ]; then
  add2virtualenv ~/Sites/env/$proj_name/lib/python2.7/site-packages
fi

# "cd" into the virtualenv, or its "project" folder if there is one
if [ -d ~/Sites/env/$proj_name/project ]; then
  cd ~/Sites/env/$proj_name/project
else
  cd ~/Sites/env/$proj_name
fi

Solution

  • Did you create your new virtual env with the previous virtualenv activated? The best thing here is to remove the hole folder of your new virtualenv and start all over again. Try to do it first with a temporal virtualenv, and be sure to deactive and active all virtualenvs properly. Good luck with that!