4

I want to install Sphinx 1.1.3 for python 2.6. However, I don't have sudo rights. So instead of installing it in the default place, I want to set a different location, using --prefix. Doing the following:

-bash-3.2$ easy_install Sphinx-1.1.3-py2.6.egg --prefix=/homes/ndeklein/python2.6/site-packages/

gives me:

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-18534.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/lib/python2.4/site-packages/

Am I typing something wrong with the prefix? Also, what I could use instead (which I've used with other packages):

python setup.py install --home=/homes/ndeklein/python2.6/site-packages/

but I can't find the setup.py script. I'm guessing that EGGs don't have a setup.py script, is that true?

3 Answers 3

6

You need to specify options before the package, so the command should be:

easy_install --prefix=/homes/ndeklein/python2.6/site-packages/ Sphinx-1.1.3-py2.6.egg 
0
4

This website discusses non-root python installs. It might be useful to you...

http://www.astropython.org/tutorials/user-rootsudo-free-installation-of-python-modules7/

To quote a little bit of it:

A user configuration file, ~/.pydistutils.cfg, will override the internal system path for python package installations, redirecting the built libraries (lib), scripts (bin) and data (share) into user owned and specified directories. You must simply tell the python installer where theses directories are located.

The user file, ~/.pydistutils.cfg, has the following lines, using a pretty obvious syntax:

[install]
install_scripts = ~/usr/bin
install_data = ~/usr/share
install_lib = ~/usr/lib/python2.4/site-packages

Of course, whatever directories you specify there should probably exist and you should put them at the front of your PYTHONPATH:

export PYTHONPATH=~/usr/lib/python2.4/site-packages:${PYTHONPATH}

It also looks like more modern python installations (compared to the things in the link) should be able to use the ~/.local directory:

easy_install --prefix=~/.local ...

There is also:

easy_install --user ...

which will install to a user-specific site directory.

3
  • Appareantly the source code did have the setup.py, so I used that, but becasue it is a very handy link I accepted your answer. Apr 4, 2012 at 12:01
  • Yeah, I just found this link the other day for a colleague of mine ... previously, when I didn't have root, I installed a private version of python (I wanted 2.7 anyway...), but I bookmarked this link because it seemed so useful.
    – mgilson
    Apr 4, 2012 at 13:25
  • 1
    @MarkKCowan -- Yeah, it would have. If 27yr old me knew what 31yr old me knows about StackOverflow etiquette, it would have been a better post :-). I'll work on updating it. For now, I've fixed the link.
    – mgilson
    Jul 7, 2016 at 23:37
0

You could try using pip install of easy_install(pip is recommended over easy_install these days)

Then you can just use

pip install --user Sphinx

see http://www.pip-installer.org/en/latest/installing.html on how to install pip if needed

You may also want to pip install virtualenv and work inside virtualenv(where pip will install all packages in a local site packages folder). see http://pypi.python.org/pypi/virtualenv for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.