New Django installation

I just got a new machine, with x64 processor (Pentium D Dual Core — nice machine!) and naturally it’s already running Linux. SUSE 10, to be specific.
Now I wanted to move my Django project over from the old machine and the Django installation kept failing. The setup.py told me:

Installed /home/tietze/temp/Django-0.91
Because this distribution was installed --multi-version or --install-dir,
before you can import modules from this package in an application, you
will need to 'import pkg_resources' and then use a 'require()' call
similar to one of these examples, in order to select the desired version:
    pkg_resources.require("Django")  # latest installed version
    pkg_resources.require("Django==0.91")  # this exact version
    pkg_resources.require("Django>=0.91")  # this version or higher

But calling django-admin.py always resulted in

No module named pkg_resources

– no mater how often I ran ez_setup.py or whatever. This was rather frustrating, since the Django installations on my previous machine were such a breeze.

It appears that the Python packaging tool is confused by the fact that 64 bit SUSE puts Python stuff under /usr/lib64 instead of /usr/lib and then assumes that it was installed to a non-standard location which isn’t on any Python path.

I finally found the solution here:
http://www.mail-archive.com/distutils-sig@python.org/msg01667.html

Specifically this recommendation:

“They need to add:

[easy_install]
site_dirs = /usr/lib64/python2.4/site-packages

to /usr/lib64/python2.4/distutils/distutils.cfg. This file probably
doesn’t exist; just create it.”

That did it. Created file, re-ran python ez_setup.py -U setuptools and then python setup.py install and now my new Django installation seems to be working. After a couple of minutes of frustration, that was actually quite easy.

Technorati Tags: ,

Bookmark on del.icio.us
Add this post to digg.com
Bookmark on reddit.com

Posts related to this one:

4 Responses to “New Django installation”

  1. import this. » Blog Archive » Django and 64-bit Linux Says:

    […] Daniel just got a new box with a 64-bit processor, so he is moving his Django project over to it. But he ran into some problems: It appears that the Python packaging tool is confused by the fact that 64 bit SUSE puts Python stuff under /usr/lib64 instead of /usr/lib and then assumes that it was installed to a non-standard location which isn’t on any Python path. […]

  2. Archatas Says:

    I think, another way to solve your problem was to create appropriate symlinks, so that the required directories were found on the python path.

  3. Archatas Says:

    BTW, did you manage to install PIL (Python Imaging Library) on SUSE Linux as well? PIL tends to be used by Image Field in Django. If you installed that library succesfully, could you share your experiences about that?

  4. Daniel Tietze Says:

    Archatas - Yes, I’m using PIL in my app. If I remember correctly, PIL was included in the SUSE 10 DVD as an RPM and I just installed it via Yast.

    P.S. Yeah - I just checked. I installed python-imaging-1.1.4-298, which comes with the SUSE distribution.

Leave a Reply