setup.py when you can't write to site-packages?

A

andybak

There are several gaps in my Python knowledge, one of which is the what
exactly setuptools does and how it works.

I'm on a shared host so can't write to site-packages therefore most
setup.py's fail.

My strategy for pure python packages is to run setup.py locally and
copy anything that gets put in site-packages across to the shared host
somewhere in my Python path. I'm sure there is a better solution!

What's the best approach for situations when you can't tamper with the
Python install?
 
D

Diez B. Roggisch

andybak said:
There are several gaps in my Python knowledge, one of which is the what
exactly setuptools does and how it works.

I'm on a shared host so can't write to site-packages therefore most
setup.py's fail.

My strategy for pure python packages is to run setup.py locally and
copy anything that gets put in site-packages across to the shared host
somewhere in my Python path. I'm sure there is a better solution!

What's the best approach for situations when you can't tamper with the
Python install?

If you've got setuptools installed, you can use the development mode + a
staging dir that you put in your PYTHONPATH. Then the copying is done for
you.

Diez
 
A

andybak

Thanks Diez.

For one thing I was getting setuptools mixed up with distutils. Then it
occurred to me that this might be covered in the standard distutils
docs (obvious I know but before I was thinking of it as a general
Python problem and therefore wasn't sure where it might be documented)

The solution was therefore right in plain view:
http://docs.python.org/inst/alt-install-windows.html (despite the
misleading url this page applies to Unix)

(Must. Check. Docs. Before. Posting.)
 
S

skip

andy> What's the best approach for situations when you can't tamper with
andy> the Python install?

python setup.py install --prefix=/some/where/else

The arg to --prefix is analogous to /usr or /usr/local. For example, if you
are running Python 2.4, your files will wind up in

/some/where/else/lib/python2.4/site-packages

Just add that directory to PYTHONPATH and you should be good to go.

Skip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top