471,072 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,072 software developers and data experts.

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

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.

May 14 '07 #1
4 1466
jm*****@gmail.com wrote:
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
May 14 '07 #2
On May 14, 6:00 pm, James Stroud <jstr...@mbi.ucla.eduwrote:
jmg3...@gmail.com 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.

May 15 '07 #3
On May 14, 8:55 pm, jmg3...@gmail.com wrote:
On May 14, 6:00 pm, James Stroud <jstr...@mbi.ucla.eduwrote:
jmg3...@gmail.com 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!)
May 15 '07 #4
On 15 Mai, 02:55, jmg3...@gmail.com wrote:
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

May 21 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by aznach | last post: by
6 posts views Thread by matey | last post: by
24 posts views Thread by Joe Salmeri | last post: by
3 posts views Thread by sapsi | last post: by
7 posts views Thread by Yansky | last post: by
1 post views Thread by Martin Rubey | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.