Debian Sarge Install

1 view
Skip to first unread message

gh

unread,
Oct 22, 2005, 12:17:03 PM10/22/05
to TurboGears
Thanks to the fine work of Phillip J. Eby and Ian Bicking, I was able
to work out the proper method of installation on Debian Sarge
(conforming to policy and not running the install as root).

You must be in the 'staff' group (allows you to write /usr/local/
tree).

First install python2.4: sudo apt-get install python2.4-dev

Next, create: ~/.pydistutils.cfg

cat > ~/.pydistutile.cfg << EOF
[install]
install_lib = /usr/local/lib/python$py_version_short/site-packages
EOF

Now the install will work without being root.

python2.4 ez_setup.py -f http://www.turbogears.org/download/index.html
--script-dir /usr/local/bin TurboGears

--gh
[p.s. Kevin ... sorry about previously spamming you with the same
message ... laziness ... too much perl.]

gh

unread,
Oct 22, 2005, 12:48:48 PM10/22/05
to TurboGears
Correction/Addition.

The previous works fine for installation but "kid" won't run.

I created ~/py/sitecustomize.py

cat > py/sitecustomize.py <<EOF
import sys, os, os.path

setuptools_dir = '/usr/local/lib/python2.4/site-packages'
for x in os.listdir(os.path.expanduser(setuptools_dir)):
eggpath = os.path.join(setuptools_dir, x)
if x.endswith('.egg') and os.path.isdir(eggpath):
sys.path.insert(0, eggpath)
EOF

and used:
export PYTHONPATH=~/py:/usr/local/lib/python2.4

and now "kid" runs.

--gh
[python newbie ... :-)]

Phillip J. Eby

unread,
Oct 22, 2005, 2:14:37 PM10/22/05
to TurboGears
gh wrote:
> Correction/Addition.
>
> The previous works fine for installation but "kid" won't run.
>
> I created ~/py/sitecustomize.py
>
> cat > py/sitecustomize.py <<EOF
> import sys, os, os.path
>
> setuptools_dir = '/usr/local/lib/python2.4/site-packages'
> for x in os.listdir(os.path.expanduser(setuptools_dir)):
> eggpath = os.path.join(setuptools_dir, x)
> if x.endswith('.egg') and os.path.isdir(eggpath):
> sys.path.insert(0, eggpath)
> EOF

I strongly recommend that people *not* do this! You will prevent
easy_install from being able to work correctly with your installation
in the future!

Setuptools 0.6a6 supports installation to almost any directory using
PYTHONPATH if you want to do it that way, and it also includes a script
to setup a virtual Python if you prefer using that approach. But you
will need to get rid of the above cruft.

For the correct non-root installation instructions for 0.6a6, please
see:


http://cvs.sourceforge.net/viewcvs.py/python/python/nondist/sandbox/setuptools/EasyInstall.txt?view=markup

Or better yet, just use this script to create a ~/bin/python that will
do everything as it should:

http://peak.telecommunity.com/dist/virtual-python.py

It should work even with setuptools 0.6a5.

I strongly recommend that you get rid of the sitecustomize.py and the
/usr/local stuff you did, and use either the virtual-python script or
upgrade to setuptools 0.6a6 from CVS.

Please, don't anybody else do what's described here - easy_install will
NOT work properly if you do this. Somebody posted these broken
instructions to the Wiki, but I got distracted working on 0.6a6 and
forgot to delete them from the Wiki. I've now added a warning to the
wiki page that you should BACK OUT these steps if you've done them.
Use the virtual-python script or use 0.6a6; those are the only safe
choices.

Guy Hulbert

unread,
Oct 22, 2005, 3:03:17 PM10/22/05
to turbo...@googlegroups.com
On Sat, 2005-22-10 at 11:14 -0700, Phillip J. Eby wrote:
> gh wrote:
> > Correction/Addition.
> >
> > The previous works fine for installation but "kid" won't run.

You did not comment on "previous". Is that ok ?

> >
> > I created ~/py/sitecustomize.py
<snip>
> I strongly recommend that people *not* do this! You will prevent
> easy_install from being able to work correctly with your installation
> in the future!
>
> Setuptools 0.6a6 supports installation to almost any directory using
> PYTHONPATH if you want to do it that way, and it also includes a script
> to setup a virtual Python if you prefer using that approach. But you
> will need to get rid of the above cruft.
>
> For the correct non-root installation instructions for 0.6a6, please
> see:
>
>
> http://cvs.sourceforge.net/viewcvs.py/python/python/nondist/sandbox/setuptools/EasyInstall.txt?view=markup

This page is novel-length.

>
> Or better yet, just use this script to create a ~/bin/python that will

I don't want a ~/bin/python or PYTHONPATH. If I have to have one of the
two, PYTHONPATH is the lesser of two evils.

Debian gives me a fully working python
plus /usr/local/lib/python2.4/site-packages/

But turbo-gears by default installs in /usr/lib.

Perl modules just work as expected.

> do everything as it should:
>
> http://peak.telecommunity.com/dist/virtual-python.py
>
<snip>
> Use the virtual-python script or use 0.6a6; those are the only safe
> choices.
>

I'll try to get turbogears to use 0.6a6 then.


--
--gh


Phillip J. Eby

unread,
Oct 22, 2005, 3:38:17 PM10/22/05
to TurboGears
Guy Hulbert wrote:
> On Sat, 2005-22-10 at 11:14 -0700, Phillip J. Eby wrote:
> > gh wrote:
> > > Correction/Addition.
> > >
> > > The previous works fine for installation but "kid" won't run.
>
> You did not comment on "previous". Is that ok ?

Partly. If you want to be able to use easy_install with it, you should
also add this to your ~/.pydistutils.cfg:

[easy_install]
site-dirs = /usr/local/lib/python2.4/site-packages

Doing this should then eliminate the need for the sitecustomize.py
hack, because then easy_install can set an "active" version of a
package.

Assuming that Debian is adding the
/usr/local/lib/python2.4/site-packages directory to sys.path, then this
should be all you need. You should not even need to set PYTHONPATH; it
should Just Work, as long as you rerun easy_install on the packages
you've already installed, so it sets them as the active versions. (It
won't need to re-download them, it'll just add them to a .pth file.)

I should probably add some notes about this Debian-specific issue to
EasyInstall.txt, but of course that would increase its length. ;)

Guy Hulbert

unread,
Oct 22, 2005, 4:33:05 PM10/22/05
to turbo...@googlegroups.com
On Sat, 2005-22-10 at 12:38 -0700, Phillip J. Eby wrote:
> Guy Hulbert wrote:
> > On Sat, 2005-22-10 at 11:14 -0700, Phillip J. Eby wrote:
> > > gh wrote:
> > > > Correction/Addition.
> > > >
> > > > The previous works fine for installation but "kid" won't run.
> >
> > You did not comment on "previous". Is that ok ?
>
> Partly. If you want to be able to use easy_install with it, you should
> also add this to your ~/.pydistutils.cfg:
>
> [easy_install]
> site-dirs = /usr/local/lib/python2.4/site-packages

I have:

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

But it didn't seem to work.

>
> Doing this should then eliminate the need for the sitecustomize.py
> hack, because then easy_install can set an "active" version of a
> package.
>
> Assuming that Debian is adding the
> /usr/local/lib/python2.4/site-packages directory to sys.path, then this

It's done in site.py

> should be all you need. You should not even need to set PYTHONPATH; it
> should Just Work, as long as you rerun easy_install on the packages
> you've already installed, so it sets them as the active versions. (It
> won't need to re-download them, it'll just add them to a .pth file.)
>
> I should probably add some notes about this Debian-specific issue to
> EasyInstall.txt, but of course that would increase its length. ;)

Actually, I started from a link to the non-root install section.

At the moment I'm just trying to get things running to play with tg. I
will re-install the entire box before I use anything in production.

I'm going to delete everything and start over ... I'll post a reply when
it works. Thanks for the help and the code.

>

--
--gh


Guy Hulbert

unread,
Oct 22, 2005, 4:43:52 PM10/22/05
to turbo...@googlegroups.com
Here is where I am now. Removed everything from the system. Logged out
and in to eliminate PYTHONPATH.

$ cat > .pydistutils.cfg <<EOF
[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
EOF
$ python2.4 ez_setup.py -f \
> http://www.turbogears.org/download/index.html \
> --script-dir /usr/local/bin TurboGears
$ easy_install
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 5, in ?
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

Do I need the .6a6 release of easy_install ?

--gh
--
--gh


Guy Hulbert

unread,
Oct 22, 2005, 4:56:19 PM10/22/05
to turbo...@googlegroups.com
On Sat, 2005-22-10 at 16:43 -0400, Guy Hulbert wrote:
> Here is where I am now. Removed everything from the system. Logged out
> and in to eliminate PYTHONPATH.
>
> $ cat > .pydistutils.cfg <<EOF
> [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
> EOF
> $ python2.4 ez_setup.py -f \
> > http://www.turbogears.org/download/index.html \
> > --script-dir /usr/local/bin TurboGears
> $ easy_install
> Traceback (most recent call last):
> File "/usr/local/bin/easy_install", line 5, in ?
> from pkg_resources import load_entry_point
> ImportError: No module named pkg_resources
>
> Do I need the .6a6 release of easy_install ?

And the answer is ... YES!.

So the above works as long as ez_setup.py references 6a6 rather than 6a5
(i edited it and everything works).

Thanks Phillip.

>
> --gh
>
>
<snip>


Reply all
Reply to author
Forward
0 new messages