[gdal-dev] Python installation can't find gdal_array.py
Jorge Arévalo
jorge at cartodb.com
Wed Jan 28 09:51:28 PST 2015
Hi,
> Even Rouault <mailto:even.rouault at spatialys.com>
> January 28, 2015 at 6:44 PM
> Jorge,
>
>> I've compiled GDAL from trunk, specifying --with-python at configure
>> time. I first checked numpy is correctly installed. The problem is I
>> couldn't import gdal_array.py by default (got ImportError: no module
>> named _gdal_array).
>>
>> Tried
>>
>> python gdal_sources/swig/python/setup.py install
>>
>> Didn't work.
>
> "didn't work", could you be more precise ?
> "python setup.py install" requires root rights since it installs in
> /usr/local/lib. There's a ticket&debate if the python bindings should honour
> the --prefix specified at configure time or not. Currently they don't, and it is
> an annoyance for folks. Perhaps we should revert to honour the prefix, but this
> was disabled at some point and nobody remembers why...
Yes, I felt the pain of python bindings don't honouring the --prefix
specified... Good to know there's a debate on this.
Sorry about my vague description. I just did it using sudo, for a system
installation, and after that, system Python still didn't find the path.
So, after
sudo python gdal_sources/swig/python/setup.py install
I still get the same error:
ImportError: no module named _gdal_array
>> I finally had to define
>>
>> export PYTHONPATH=$PYTHONPATH:$/usr/local/lib/python2.7/dist-packages/osgeo
>>
>> to make it work. And I don't think that's the default solution, right?
>
> That's what I use since I have many GDAL versions on my machine and must
> switch between them without reinstalling. For regular users not tweaking the
> installation prefix, "sudo make install" should do the right thing however.
Yep, that was what I thought. But still fails after sudo make install.
The only way I've found to make it work is by exporting PYTHONPATH
Best regards,
Jorge
>> Am I doing something wrong?
>>
>> Environment: Ubuntu 14.10, GDAL from trunk, Python 2.7.8
>>
>
> Even
>
--
Sent with Postbox <http://www.getpostbox.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150128/74944820/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150128/74944820/attachment.jpg>
More information about the gdal-dev
mailing list