customary way of keeping your own Python and module directory in $HOME

J

jmg3000

What's the customary way to keep your own local Python and package
directory? For example, when you're on a server where you don't have
root access, and everything must go in your home directory.

* What directories do you create?
* What environment variables do you set?
* What config files do you keep?
* Does that setup work with distutils and setuptools? What special
options do you need to pass to these tools when installing modules for
everything to work right?

Please, share your tips.
 
J

James Stroud

What's the customary way to keep your own local Python and package
directory? For example, when you're on a server where you don't have
root access, and everything must go in your home directory.

* What directories do you create?
* What environment variables do you set?
* What config files do you keep?
* Does that setup work with distutils and setuptools? What special
options do you need to pass to these tools when installing modules for
everything to work right?

Please, share your tips.

You can do more than you can imagine as non-root even if you have
hyper-paranoid sysadmins who don't know how to protect infrastructure
without shackling the users.

I don't know about windoze (pro-windoze complainers: yep, I'm spelling
it wrong on purpose, please complain elsewhere about my anti-windoze
spelling :p -- If you want to be a pro-windoze speller, take the time to
give your own answers instead of complaining all the time), but on *nix,
you can compile python with the "--prefix=" option set to a directory in
your home dir and install there. Because python is compiled with the
prefix, you will not need to adjust the path if you add modules to the
site-packages directory. If you have your own modules, but they aren't
ready for site-packages, you can alter PYTHONPATH to point at your
staging directory.

I recommend having your own python install if you want a comprehensive
approach. Sometimes you need to build your own Tcl/Tk and blt-wish if
you have a linux version that predates the python dependency
requirements, though. If you know the dependencies, its all very
"configure --prefix= ; make ; make install", with proper settings of
LD_LIBRARY path.

Doesn't seem like hyper-paranoid sysadmining is all that efficient, does it?

James
 
J

jmg3000

(e-mail address removed) wrote:
[snip], but on *nix,
you can compile python with the "--prefix=" option set to a directory in
your home dir and install there.
Check.

I recommend having your own python install if you want a comprehensive
approach.

Yup. I dropped the src in ~/src/Python-2.5.1, created a ~/py-2.5.1
directory, and did

../configure --prefix=/home/me/py-2.5.1
make
make install

and it worked fine. The only other step after that was creating a
symlink:

cd
ln -s py-2.5.1 py

and adding /home/me/py/bin to my $PATH.
Doesn't seem like hyper-paranoid sysadmining is all that efficient, does it?

Well, on a server with many other users, they've pretty much gotta
keep you confined to your home directory.

My issues have been with keeping a ~/pylib directory for extra
modules, and reconciling that with setuptools / Easy Install. I'm
curious to hear how other folks manage their own local module
directory.
 
T

timw.google

(e-mail address removed) wrote:
[snip], but on *nix,
you can compile python with the "--prefix=" option set to a directory in
your home dir and install there.
Check.

I recommend having your own python install if you want a comprehensive
approach.

Yup. I dropped the src in ~/src/Python-2.5.1, created a ~/py-2.5.1
directory, and did

./configure --prefix=/home/me/py-2.5.1
make
make install

and it worked fine. The only other step after that was creating a
symlink:

cd
ln -s py-2.5.1 py

and adding /home/me/py/bin to my $PATH.
Doesn't seem like hyper-paranoid sysadmining is all that efficient, does it?

Well, on a server with many other users, they've pretty much gotta
keep you confined to your home directory.

My issues have been with keeping a ~/pylib directory for extra
modules, and reconciling that with setuptools / Easy Install. I'm
curious to hear how other folks manage their own local module
directory.

I just do

../configure --prefix=$HOME;make;make install

My PATH has $HOME/bin, and LD_LIBRARY_PATH has $HOME/lib before the
system bin and lib directories. Everything works just fine. I do the
same thing for everything else I download for personal use when I want
to use a more up to date version of what's installed. For Windoze,
Python gets installed in C:\Python24 (or C:\Python25 now, I guess) and
you don't need admin rights for that. (Thank you, Python developers!)
 
C

Christopher Arndt

My issues have been with keeping a ~/pylib directory for extra
modules, and reconciling that with setuptools / Easy Install. I'm
curious to hear how other folks manage their own local module
directory.

For Python libraries, I use the workingenv.py (search Cheeseshop) for
keeping a separate environment for every application with all the
libraries it needs. This is great to dodge problems with two apps
requiring different, uncompatible versions of the same library, for
having different staging and production environments, and so on.

Once you activate an environment (in a shell or in your Python
script), the PYTHONPATH and the installation directories for distutils
and easy_install will be adapted automatically.

Chris
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top