Opened 8 years ago

Closed 8 years ago

#5274 closed defect (duplicate)

install Python extension ignores prefix

Reported by: Mike Taves Owned by: hobu
Priority: normal Milestone:
Component: PythonBindings Version: 1.10.1
Severity: normal Keywords:
Cc:

Description

On a CentOS system where I don't have root access, building and installing GDAL with Python bindings is a bit tricky. I have access to the /amp/gp/sw directory, which I use as a prefix for other software. Here are my commands, with a bit of context output:

$ ./configure --with-python --prefix=/amp/gp/sw
...
$ make
...
$ make install
...
make[1]: Entering directory `/amp/gp/src/gdal/gdal-1.10.1/swig'
for dir in python ; do (cd $dir; make install) || exit; done
make[2]: Entering directory `/amp/gp/src/gdal/gdal-1.10.1/swig/python'
python setup.py install 
running install
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/lib64/python2.6/site-packages/test-easy-install-31660.write-test'

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

    /usr/lib64/python2.6/site-packages/

While the GDAL libraries were correctly installed to my prefix specification, this prefix was not used for the Python package installation. My workaround was to manually install the Python package with the same prefix:

$ cd swig/python
$ python setup.py install --prefix=/amp/gp/sw
...
creating /amp/gp/sw/lib64/python2.6/site-packages/GDAL-1.10.1-py2.6-linux-x86_64.egg
Extracting GDAL-1.10.1-py2.6-linux-x86_64.egg to /amp/gp/sw/lib64/python2.6/site-packages
Removing GDAL 1.9.0 from easy-install.pth file
Adding GDAL 1.10.1 to easy-install.pth file

Installed /amp/gp/sw/lib64/python2.6/site-packages/GDAL-1.10.1-py2.6-linux-x86_64.egg
Processing dependencies for GDAL==1.10.1
Finished processing dependencies for GDAL==1.10.1

Change History (2)

comment:1 Changed 8 years ago by Mike Taves

Another workaround is to edit swig/python/GNUmakefile (line 71):

    $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix)

then "make install" completes successfully. This isn't a good general solution, since I know that the default python install path is different than the default prefix (/usr/local).

I also see an unused make variable INST_PYMOD that is only referenced in GDALmake.opt.in, and never gets initialised or used elsewhere.

comment:2 Changed 8 years ago by Even Rouault

Resolution: duplicate
Status: newclosed

This is a duplicate of #4563

Note: See TracTickets for help on using tickets.