1

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?

2
  • do this pip freeze | grep -i django
    – Mike
    Jun 22, 2010 at 17:26
  • Thanks, Mike. The package is indeed listed in the pip freeze output. Jun 22, 2010 at 18:19

3 Answers 3

1

Doing this a little late, since Django 1.2 has been out for a while now, but I just removed the old install:

sudo apt-get remove python-django

And then installed the new version of Django (1.2.3 at the time) using:

sudo easy_install django
0

Take a all require backup then i just follow link for the upgrade i got working i'm using centos 5.2 django-upgrade

4
  • Backup your files then use django-upgrade.
    – mcandre
    Jun 22, 2010 at 18:22
  • Rajat, mcandre, I see no reference to "django-upgrade" anywhere on the linked page. Google isn't too helpful either. Jun 22, 2010 at 18:26
  • I didn't mean to upgrade in fact i have remove every thing and re-install just using link.
    – Rajat
    Jun 22, 2010 at 18:36
  • The problem is, I don't know how to remove everything because it seems to have files all over the place. Jun 23, 2010 at 0:25
0

run

pip uninstall Dhango

then

pip install Django==1.1
1
  • pip won't uninstall it because the package contains files outside of /usr. The error message is: "Not uninstalling Django at /var/lib/python-support/python2.6, outside environment /usr". See the link in the original question. Jun 23, 2010 at 0:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .