Monday, November 29, 2010

Re: Installing on Ubuntu Python 2.6- Install failure

On Mon, Nov 29, 2010 at 6:56 AM, Tim Bowden <tim.bowden@gmail.com> wrote:
When installing django from an official release tarball onto Ubuntu
10.04 python 2.6, (python setup.py install) it installs to
/usr/local/lib/python2.6/dist-packages/ rather than
/usr/lib/python2.6/dist-packages (as reported by python -c "from
distutils.sysconfig import get_python_lib; print get_python_lib()").

Is this expected behaviour?  If so, the install instructions and
tutorial will need to be updated.  How should django best be imported
into a running python interpreter in this case?  import django
returns:
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named django

I solved the problem by doing python setup.py build then manually
copying build/django into /usr/local/lib/python2.6/dist-packages, but
that is not a very user friendly procedure.

Is this an Ubuntu/python 2.6 specific issue?  Should the install
instructions be updated or is this a bug in the packaging?


On that system, I believe it is expected behavior that Django gets installed in /usr/local/lib/python2.6/dist-packages when installed via setup.py. Per the Debian packaging doc (http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html), this is "[a] special directory [that] is dedicated to public Python modules installed by the local administrator, /usr/local/lib/pythonX.Y/dist-packages for python2.6 and later". What is unexpected in your case is that this directory is not in the system default sys.path. It is in sys.path on my Ubuntu 10.04 box (as is the other directory, which is called "the system Python modules directory" in that packaging doc):

Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python2.6/dist-packages/pip-0.8.1-py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']
>>> '/usr/local/lib/python2.6/dist-packages' in sys.path
True
>>> '/usr/lib/python2.6/dist-packages' in sys.path
True
>>>

Karen
--
http://tracey.org/kmt/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment