How do I upgrade django on ubuntu 9.04?
- by Lorin Hochstein
I've got Django 1.0.2 installed on Ubuntu 9.04. I'd like to upgrade Django, because I have an app that needs Django 1.1 or greater. I tried using pip to do the upgrade, but got the following:
$ sudo pip install Django==1.1
Downloading/unpacking Django==1.1
Downloading Django-1.1.tar.gz (5.6Mb): 5.6Mb downloaded
Running setup.py egg_info for package Django
Installing collected packages: Django
Found existing installation: Django 1.0.2-final
Not uninstalling Django at /var/lib/python-support/python2.6, outside environment /usr
Running setup.py install for Django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed Django
It seems like it worked, but it refuses to remove the original Django 1.02, and sure enough:
$ pip freeze | grep -i django
Django==1.0.2-final
django-debug-toolbar==0.8.3
django-sphinx==2.2.3
$ /usr/local/bin/django-admin.py --version
1.0.2 final
The problem, apparently, is that pip won't uninstall files outside of /usr.
I'd like to remove the existing Django files manually, but I have no idea how to do that, because I'm unfamiliar with how Python packages are laid out in Ubuntu. It looks pretty complicated.
The site-packages directory is:
$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
/usr/lib/python2.6/dist-packages
However, that's not where the django files live:
$ ls -ld /usr/lib/python2.6/dist-packages/[Dd]jango*
ls: cannot access /usr/lib/python2.6/dist-packages/[Dd]jango*: No such file or directory
There's a /var/lib/python-support/python2.6/django directory, and the __init__.py file in that directory points to /usr/share/python-support/python-django/django/__init__.py.
Clearly, pip is able to figure out where the files live. Is there any way to retrieve the list of files associated with the django package so I can just delete them manually?