Trouble installing on Debian unstable

4 views
Skip to first unread message

Martin Skøtt

unread,
Nov 10, 2005, 8:13:45 AM11/10/05
to turbo...@googlegroups.com
I have tried following this[1] guide to install TurboGears on Debian
unstable, but it doesn't work. I get this error when running tg-admin quickstart:

tg-admin quickstart Traceback (most recent call last):
File "/usr/local/bin/tg-admin", line 5, in ?
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

I have tried searching the archives, but I havn't been able to get it
to work. I have tried both with the ez_setup.py from turbogears.org[2]
and the one from PEAK[3].

The eggs are installed in /usr/local/lib/python2.4/site-packages which
is in the PYTHONPATH for python2.4:

$ python2.4
Python 2.4.2 (#2, Sep 29 2005, 00:23:59)
[GCC 4.0.2 (Debian 4.0.1-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python24.zip', '/usr/lib/python2.4',
'/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
'/usr/lib/python2.4/lib-dynload',
'/usr/local/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages', '/usr/lib/site-python']

Any hints on what I might be missing ? I have spent a couple of hours
on this with no luck :(

[1] http://trac.turbogears.org/turbogears/wiki/SystemInstall
[2] http://turbogears.org/download/ez_setup.py
[3] http://peak.telecommunity.com/dist/ez_setup.py
--
Regards
Martin Skøtt

Wavy Davy

unread,
Nov 10, 2005, 9:02:35 AM11/10/05
to turbo...@googlegroups.com
On 10/11/05, Martin Skøtt <mar...@z3n.dk> wrote:
>
> I have tried following this[1] guide to install TurboGears on Debian
> unstable, but it doesn't work.

Given my distro (gentoo) doesn't yet package TurboGears (does any?), I
opted to go the non-root install way, using

http://peak.telecommunity.com/DevCenter/EasyInstall#non-root-installation

and the virtual-python script there to create a user-based python
install, and used easy_install for the installing TG.

basically:

$ python virtual-python.py
$ python ez_setup.py
$ easy_install -D -f http://www.turbogears.org/download/index.html TurboGears

All the dependencies were resolved automagically. AFAIK, this should
work for any system with python 2.4 installed.

I don't like installing software to to /usr without using whatever
package management systems provided, as it can get messy to maintain.
It also makes installing TG on my webserver, where I don't have root,
very easy.

HTH

ps.
I now use the nightly TG snapshot egg from

http://www.opensource4you.com/nightly_tarballs.shtml

but this requires some manual dependency tracking (for nose at least)
as I couldn't find the location of a nose egg online. All the new
Paste dependencies worked fine from PyPI. And it lets me play with all
the new toys :)

--
wavy davy

"True religon confronts earth with heaven
and brings eternity to bear on time"
- A. W. Tozer

Paul Dale

unread,
Nov 10, 2005, 9:13:24 AM11/10/05
to turbo...@googlegroups.com

I am running TG on Debian. I had a wee bit of trouble originally with the ez_setup.

The one comment I would make is that if it doesn't work exactly as indicated on the download page then try reinstalling.Delete all the related files (especially if doing it on a different day ... the builds change fairly often), and do it again.

For whatever its worth it will run on debian unstable without particular modification.

Good luck.

Paul

Martin Skøtt

unread,
Nov 10, 2005, 9:47:30 AM11/10/05
to turbo...@googlegroups.com
On Thu, Nov 10, 2005 at 02:02:35PM +0000, Wavy Davy wrote:
>
> On 10/11/05, Martin Skøtt <mar...@z3n.dk> wrote:
> >
> > I have tried following this[1] guide to install TurboGears on Debian
> > unstable, but it doesn't work.
>
> Given my distro (gentoo) doesn't yet package TurboGears (does any?), I
> opted to go the non-root install way, using
>
> http://peak.telecommunity.com/DevCenter/EasyInstall#non-root-installation
>
> and the virtual-python script there to create a user-based python
> install, and used easy_install for the installing TG.

That seems a little cumbersome to me. Usefull for situations where you
can't become root, but that isn't the case for me.

> I don't like installing software to to /usr without using whatever
> package management systems provided, as it can get messy to maintain.
> It also makes installing TG on my webserver, where I don't have root,
> very easy.

I feel the same way except AFAIK /usr/local/ exists for just that
reason. /usr/local/ is locally installed stuff untouched by packages.
--
Regards
Martin Skøtt

bon...@gmail.com

unread,
Nov 10, 2005, 10:02:10 AM11/10/05
to TurboGears
Use the non-root installation, even you are root. setuptools conflicts
with your package system. You can use non-root install to /usr/local
which can still be shared by all users.

I do it on my sarge system.

Kevin Dangoor

unread,
Nov 10, 2005, 10:02:26 AM11/10/05
to turbo...@googlegroups.com
On 11/10/05, Martin Skøtt <mar...@z3n.dk> wrote:
> > I don't like installing software to to /usr without using whatever
> > package management systems provided, as it can get messy to maintain.
> > It also makes installing TG on my webserver, where I don't have root,
> > very easy.
>
> I feel the same way except AFAIK /usr/local/ exists for just that
> reason. /usr/local/ is locally installed stuff untouched by packages.

This is true. I did notice a typo in the wiki page: it said
.pydistutil*e*.cfg, so if you cut-and-pasted it, you might have the
wrong thing, but I doubt it since it sounds like you had gotten
farther than that.

Does pkg_resources.py exist in /usr/local/lib/python2.4/site-packages?
(I'm assuming not). What does appear in that directory?

Kevin

Martin Skøtt

unread,
Nov 10, 2005, 10:06:14 AM11/10/05
to turbo...@googlegroups.com
On Thu, Nov 10, 2005 at 03:13:24PM +0100, Paul Dale wrote:
> The one comment I would make is that if it doesn't work exactly as indicated on
> the download page then try reinstalling.Delete all the related files
> (especially if doing it on a different day ... the builds change fairly often),
> and do it again.

I have tried this several (uninstalling by remove the contents of
/usr/local/bin and /usr/local/lib/python2.4/site-packages) still no
luck though :(

> For whatever its worth it will run on debian unstable without particular
> modification.

Nice to hear that it can work on Debian :)

To me it looks like python2.4 fails to see anything installed in
/usr/local/lib/python2.4/site-packages/. I just tried running
ez_setup.py without any arguments and afterwards running
/usr/local/bin/easy_install, but I still get the same error.

Could it be there is something missing in
/usr/local/lib/python2.4/site-packages ? Currently it just contains a
bunch of .egg files and .edd directories.

Sorry for sounding a bit confused, but I am new to .egg's and
setuptools :)

--
Regards
Martin Skøtt

Martin Skøtt

unread,
Nov 10, 2005, 10:30:37 AM11/10/05
to turbo...@googlegroups.com
On Thu, Nov 10, 2005 at 10:02:26AM -0500, Kevin Dangoor wrote:
> This is true. I did notice a typo in the wiki page: it said
> .pydistutil*e*.cfg, so if you cut-and-pasted it, you might have the
> wrong thing, but I doubt it since it sounds like you had gotten
> farther than that.

Yeah, the type is gone from the wiki.

> Does pkg_resources.py exist in /usr/local/lib/python2.4/site-packages?
> (I'm assuming not). What does appear in that directory?

No, it's in
/usr/local/lib/python2.4/site-packages/setuptools-0.6a7-py2.4.egg/

Here is what I have in /usr/local/lib/python2.4/site-packages after a
fresh install:

martin@martin:/usr/local/lib/python2.4/site-packages$ ls -l
total 280
-rw-r--r-- 1 martin martin 198794 2005-11-10 16:20 cElementTree-1.0.2_20050302-py2.4-linux-i686.egg
drwxr-sr-x 4 martin staff 36 2005-11-10 16:20 CherryPy-2.1.0_rc2-py2.4.egg
-rw-r--r-- 1 martin martin 51660 2005-11-10 16:20 elementtree-1.2.6-py2.4.egg
drwxr-sr-x 4 martin staff 38 2005-11-10 16:20 FormEncode-0.2.3dev_r1104-py2.4.egg
-rw-r--r-- 1 martin martin 13652 2005-11-10 16:20 json_py-3.2.1-py2.4.egg
drwxr-sr-x 4 martin staff 31 2005-11-10 16:20 kid-0.7adev_r186-py2.4.egg
drwxr-sr-x 4 martin staff 4096 2005-11-10 16:20 setuptools-0.6a7-py2.4.egg
drwxr-sr-x 4 martin staff 37 2005-11-10 16:20 SQLObject-0.7.0-py2.4.egg
-rw-r--r-- 1 martin martin 11420 2005-11-10 16:19 TestGears-0.2-py2.4.egg
drwxr-sr-x 4 martin staff 38 2005-11-10 16:20 TurboGears-0.8a3-py2.4.egg

I was wondering why the isn't a single .py file in the top.
--
Regards
Martin Skøtt

Kevin Dangoor

unread,
Nov 10, 2005, 10:48:55 AM11/10/05
to turbo...@googlegroups.com
On 11/10/05, Martin Skøtt <mar...@z3n.dk> wrote:
>
> On Thu, Nov 10, 2005 at 10:02:26AM -0500, Kevin Dangoor wrote:
> > Does pkg_resources.py exist in /usr/local/lib/python2.4/site-packages?
> > (I'm assuming not). What does appear in that directory?
>
> No, it's in
> /usr/local/lib/python2.4/site-packages/setuptools-0.6a7-py2.4.egg/

OK. Now we're getting somewhere, I think... see below.

> Here is what I have in /usr/local/lib/python2.4/site-packages after a
> fresh install:
>
> martin@martin:/usr/local/lib/python2.4/site-packages$ ls -l
> total 280
> -rw-r--r-- 1 martin martin 198794 2005-11-10 16:20 cElementTree-1.0.2_20050302-py2.4-linux-i686.egg
[snippage of eggs]

> I was wondering why the isn't a single .py file in the top.

This is how eggs work. The idea is that you can actually have multiple
versions of Python packages installed and things of that nature.

What's interesting is that your site-packages does not have any .pth
files in it. My guess is that your system site-packages does not have
any useful .pth files either. This is why pkg_resources can't be
found.

Take a look at the site-dirs command line option discussion on this page:
http://peak.telecommunity.com/DevCenter/EasyInstall

To be able to find pkg_resources, either the setuptools egg directory
needs to be on your PYTHONPATH (ugly, would have to change every
update of setuptools), or you need setuptools.pth to appear in a
Python sitedir. Python only searches specific site directories for
.pth files that it uses to expand the path. The page above tells you
how you can put a single pth file in your system site-packages
directory and allow /usr/local/lib/python2.4/site-packages to act as a
sitedir.

Kevin

Phillip J. Eby

unread,
Nov 10, 2005, 11:09:47 AM11/10/05
to TurboGears
Martin Skøtt wrote:
> Could it be there is something missing in
> /usr/local/lib/python2.4/site-packages ? Currently it just contains a
> bunch of .egg files and .edd directories.

As Kevin already pointed out, you're missing the .pth files. You need
to include that directory in the --site-dirs option to easy_install.
See:


http://peak.telecommunity.com/DevCenter/EasyInstall#command-line-options

under the --site-dirs option for an explanation of how to set up an
alternate installation location. If you follow those directions and
then install again, you should end up with two more files:
setuptools.pth and easy_install.pth, and Python should actually
recognize the directory then.

Basically those are the instructions for installing in a non-standard
location when you are root and can therefore do those setup steps in
your main Python installation. Just substitute
/usr/local/lib/python2.4/site-packages for the ~/lib/python2.3 example
directory in the instructions and you should be good to go. Also, if
you want the /usr/local directory to be the default installation
location so you don't have to use -d all the time, you can also add:

[install]
install_lib = /usr/local/lib/python2.4/site-packages

to the distutils.cfg file as described in the instructions, in addition
to the site_dirs setting.

Martin Skøtt

unread,
Nov 10, 2005, 12:26:12 PM11/10/05
to turbo...@googlegroups.com
On Thu, Nov 10, 2005 at 08:09:47AM -0800, Phillip J. Eby wrote:
> under the --site-dirs option for an explanation of how to set up an
> alternate installation location. If you follow those directions and
> then install again, you should end up with two more files:
> setuptools.pth and easy_install.pth, and Python should actually
> recognize the directory then.

This was exactly what I needed to make it work :)

One strange thing is that my ~/.pydistutils.cfg has been looking like
this all the time:

[install]
install_lib = /usr/local/lib/python$py_version_short/site-packages

[easy_install]
site_dirs=/usr/local/lib/python$py_version_short/site-packages

I guess --site-dirs is the same as site_dirs being set in the file?

> to the distutils.cfg file as described in the instructions, in addition
> to the site_dirs setting.

I just noticed that neither python2.3 or python2.4 in Debian include
a distutils.cfg file. It sounds like a bug to me, so I will try to
contact the package maintainer and get him to add it (since the
/usr/local/lib/python*/site-packages dir is created by the package).

I will add some info about this to
http://trac.turbogears.org/turbogears/wiki/SystemInstall so other
Debian user won't run into the same trouble.

--
Med venlig hilsen
Martin Skøtt

Phillip J. Eby

unread,
Nov 10, 2005, 2:09:29 PM11/10/05
to TurboGears
Martin Skøtt wrote:
> On Thu, Nov 10, 2005 at 08:09:47AM -0800, Phillip J. Eby wrote:
> One strange thing is that my ~/.pydistutils.cfg has been looking like
> this all the time:
>
> [install]
> install_lib = /usr/local/lib/python$py_version_short/site-packages
>
> [easy_install]
> site_dirs=/usr/local/lib/python$py_version_short/site-packages
>
> I guess --site-dirs is the same as site_dirs being set in the file?

Yes. You can set the default for any easy_install option that way.
For boolean options, set them to 1.

Note, however, that the [easy_install] section does *not* support $
variables, so the above configuration probably doesn't work correctly.
The $ variables only work in the [install] section, and no, you can't
put site_dirs there. Just list the paths explicitly in site_dirs.


> > to the distutils.cfg file as described in the instructions, in addition
> > to the site_dirs setting.
>
> I just noticed that neither python2.3 or python2.4 in Debian include
> a distutils.cfg file. It sounds like a bug to me, so I will try to
> contact the package maintainer and get him to add it (since the
> /usr/local/lib/python*/site-packages dir is created by the package).

That would be good, as long as they also include the altinstall.pth so
that the .pth files in the /usr/local tree get handled. By having a
distutils/distutils.cfg with the defaults set as well, they will make
it easy for people to actually use /usr/local, and people won't have as
many problems using EasyInstall. They *do*, however, need to have the
/usr/local/ site-packages directory in sys.path come *before* the /usr
one, though, or locally installed packages won't be able to override
the system-installed ones.


> I will add some info about this to
> http://trac.turbogears.org/turbogears/wiki/SystemInstall so other
> Debian user won't run into the same trouble.

Good idea, and thanks.

Martin Skøtt

unread,
Nov 10, 2005, 4:04:38 PM11/10/05
to turbo...@googlegroups.com
On Thu, Nov 10, 2005 at 11:09:29AM -0800, Phillip J. Eby wrote:
> Note, however, that the [easy_install] section does *not* support $
> variables, so the above configuration probably doesn't work correctly.
> The $ variables only work in the [install] section, and no, you can't
> put site_dirs there. Just list the paths explicitly in site_dirs.

Ahh... I had just pasted in the settings from
http://trac.turbogears.org/turbogears/wiki/SystemInstall. I have
updated the guide and added a note about $ variables not being useable
under [easy_install].

> That would be good, as long as they also include the altinstall.pth so
> that the .pth files in the /usr/local tree get handled. By having a
> distutils/distutils.cfg with the defaults set as well, they will make
> it easy for people to actually use /usr/local, and people won't have as
> many problems using EasyInstall. They *do*, however, need to have the
> /usr/local/ site-packages directory in sys.path come *before* the /usr
> one, though, or locally installed packages won't be able to override
> the system-installed ones.

Great, I hope it's okay with you that I quote the above in my message
to the maintainer.

Phillip J. Eby

unread,
Nov 10, 2005, 6:08:48 PM11/10/05
to TurboGears
Martin Skøtt wrote:
> Great, I hope it's okay with you that I quote the above in my message
> to the maintainer.

I'll go further than that - feel free to have them contact me directly
if they'd like me to review their plans or patches. I want to help
system packagers make their systems as "egg friendly" as possible.

Martin Skøtt

unread,
Nov 10, 2005, 6:52:15 PM11/10/05
to turbo...@googlegroups.com
On Thu, Nov 10, 2005 at 03:08:48PM -0800, Phillip J. Eby wrote:
> I'll go further than that - feel free to have them contact me directly
> if they'd like me to review their plans or patches. I want to help
> system packagers make their systems as "egg friendly" as possible.

I posted a message on debian-python instead of filing a
bug. debian-python is _very_ low traffic, but hope someone will still
pick it up. The message is here:
http://lists.debian.org/debian-python/2005/11/msg00001.html

--
Regards
Martin Skøtt
Reply all
Reply to author
Forward
0 new messages