My favorites | Sign in
Project Logo
          
New issue | Search
for
| Advanced search | Search tips
Issue 4: setup.py install --prefix does not create directories and requires root privileges
2 people starred this issue and may be notified of changes. Back to list
Status:  Verified
Owner:  andrey.vlasovskikh
Closed:  Oct 05
Type-Defect
Priority-Medium
Component-Scripts
Milestone-0.3.4


Sign in to add a comment
 
Reported by s.astanin, Sep 08, 2009
Setup.py install

  * does not create necessary installation directories in prefix path
  * requires write access to system-wide /usr/lib/python2.5/site-packages
    even when installing to a user-writable prefix
  * is likely to interfere with package manager (due to writing to /usr/lib)

Prefix directory is user-writable (/usr/local/stow). Usually I install
manually built packages there and deploy them with GNU stow. It works for
most of the python packages I have built this was. It does not work for
funcparserlib-0.3.3

Installation log:

    funcparserlib-0.3.3$ python setup.py build
    ...
    funcparserlib-0.3.3$ python setup.py install
--prefix=/usr/local/stow/funcparserlib-0.3.3
    running install
    Checking .pth file support in
/usr/local/stow/funcparserlib-0.3.3/lib/python2.5/site-packages/
    error: can't create or remove files in install directory
    ... [ long explanations follow and suggest to create target directory ]

If I create
/usr/local/stow/funcparserlib-0.3.3/lib/python2.5/site-packages/ manually,
install terminates with an error reporting that prefix is not on PYTHONPATH.

If I define PYTHONPATH, install still terminates with:

    error: could not create 'build/bdist.linux-i686/egg': Permission denied

Then I install it like (I don't like to do it under sudo, but it seems it
requires write access to /usr/lib anyway):

    funcparserlib-0.3.3$ sudo
PYTHONPATH=/usr/local/stow/funcparserlib-0.3.3/lib/python2.5/site-packages/
python setup.py install --prefix=/usr/local/stow/funcparserlib-0.3.3
    running install
    ... [ skipping ]
    creating build/bdist.linux-i686/egg

I think `setup.py install --prefix=anyprefix` should not write anywhere
outside of `anyprefix`. I think it should create all necessary directories
automatically.

Debian/Lenny, Python 2.5.2, Setuptools 0.6c8-4


Comment 1 by andrey.vlasovskikh, Sep 09, 2009
First of all, thanks for this detailed description.

Interestingly enough, I don't use anything special in the install script (except of
using `setuptools`, not just `distutils`). As far as I know, my `setup.py` is quite
standard. I tried a `distutils` project `mercurial` and it worked as you wanted. But
`simplejson` that used `setuptools` actually failed the same way you described. Could
you specify a couple of links to projects that do the right thing for you?

I definitely agree that `python setup.py install --prefix=foo` must write files under
`foo` only. But it seems to me that the problem here is not with _install_, but with
_build_ command. The directory you are building the library from must be writable in
order to perform the build. So please check your permissions under the build
directory once again. I repeated the steps you described (`mkdir` and `PYTHONPATH`
done manually) and I didn't need root privileges.

Status: Started
Comment 2 by andrey.vlasovskikh, Sep 11, 2009
(No comment was entered for this change.)
Owner: andrey.vlasovskikh
Comment 3 by s.astanin, Oct 05, 2009
I've just tried  django (svn), it uses distutils and installs with --prefix without a
problem. As far as I remember I used to install at least Biopython, xlrd and FiPy the
same way (probably all of them use distutils).
Comment 4 by andrey.vlasovskikh, Oct 05, 2009
For this library its just fine to use the standard `distutils` so I've switched to it
from `setuptools`.

(Although it seems to me at this moment that using `pip` instead of `easy_install` is
not a good idea).

Status: Fixed
Comment 5 by andrey.vlasovskikh, Oct 05, 2009
(No comment was entered for this change.)
Labels: Component-Scripts
Comment 6 by andrey.vlasovskikh, Oct 06, 2009
(No comment was entered for this change.)
Status: Verified
Comment 7 by andrey.vlasovskikh, Oct 06, 2009
(No comment was entered for this change.)
Labels: Milestone-0.3.4
Sign in to add a comment

Hosted by Google Code