# What is the simplest way to do a user-local install of a python package?

I don't want to deal with virtualenv for a local Python installation, I just want to install a few packages locally without dealing with the PYTHONPATH environment variable, how do I do that?

-
You say "deal with" as if virtualenv was a hassle. I've found the exact opposite to be true. (Perhaps you want --system-site-packages?) –  Andreas Klöckner Sep 23 '12 at 17:09
it was hypothetically posed :) virtualenv is awesome but it doesn't fit every use case. –  Aron Ahmadia Sep 25 '12 at 10:17

Python (as of 2.6 and 3.0) now searches in the ~/.local directory for local installs, which do not require administrative privileges to install, so you just need to point your installer to that directory.

If you have already downloaded the package foo and would like to install it manually, type:

cd path/to/foo
python setup.py install --user


If you are using easy_install and would like the package downloaded and installed:

easy_install --prefix=$HOME/.local/ foo  It's a little more work if you are using pip to download and install: pip install --install-option="--prefix=$HOME/.local" foo

-

Even though I like Python as a language, distributing Python packages is a mess. I always find people not familiar with Python struggling with it.

Next to the user-local install as outlined by Aron (using --user, or --prefix), another option is EasyBuild (http://hpcugent.github.com/easybuild/). Not only for Python packages, but for any (scientific) software package. Once EasyBuild has support for it, building and installing a software package is basically a single command.

For a list of software packages currently supported, see https://github.com/hpcugent/easybuild/wiki/List-of-supported-software-packages.

Disclaimer: I am a developer of EasyBuild.

-
Kenneth Hoste, please DISCLOSE your affiliation with EasyBuild. –  Deer Hunter Jan 20 '13 at 6:23
Kenneth, welcome to SciComp! Please disclose your affiliation with EasyBuild (or any other projects you are promoting in a role other than as a user). Also, when answering questions, please only submit answers that are directly answering the question at hand. I will be deleting the answers you've submitted that don't directly address their corresponding questions. –  Geoff Oxberry Jan 20 '13 at 7:36
OK guys, thanks for the heads up. –  Kenneth Hoste Jan 20 '13 at 8:57
@AronAhmadia not if you use the --prefix option. –  Jens Timmerman Jan 21 '13 at 8:02