pdt2383
pdt2383

Reputation: 63

Installing Python Module to non-root directory

First time posting on this site.

I'm trying to install a python module named Pygments into my local directory at work (non-root). I am using C Shell, so i changed default path using

setenv PYTHONPATH "~/usr/lib/python2.4/site-packages:${PYTHONPATH}" 

(with usr/lib/... being self-made empty directories made to mimic the system's hierarchy at my boss's suggestion). I attempted to run

python setup.py install

however, I got the following error.

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'include_package_data'
warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
creating /usr/local/lib64
error: could not create '/usr/local/lib64': Read-only file system

I want the module to install to my local directory and not to any root directory. I've been stuck on this for a couple of days. Any help would be greatly appreciated.

Colten

Extra Information: I have setup.py in ~/Pygments-1.6, and I only have write access to directories within ~/.

Upvotes: 3

Views: 7332

Answers (1)

mgilson
mgilson

Reputation: 309841

PYTHONPATH is where python looks for modules, not where it chooses to install modules. You need to specify that on the setup.py line:

python setup.py install --prefix=${HOME}/usr/

or something similar. Another thing that you'll see in these cases is:

python setup.py install --user

which will put it in: '${HOME}/.local/lib/pythonX.Y/site-packages' (And I believe that this path should be searched by python for modules by default.)

Upvotes: 5

Related Questions