SCIENTIFIC-LINUX-USERS Archives

April 2017

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nico Kadel-Garcia <[log in to unmask]>
Reply To:
Nico Kadel-Garcia <[log in to unmask]>
Date:
Sat, 15 Apr 2017 06:58:29 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (144 lines)
On Sat, Apr 15, 2017 at 5:16 AM, Andrew C Aitchison
<[log in to unmask]> wrote:
> On Sat, 15 Apr 2017, Roxana Tesileanu wrote:
>
>> Hi!
>>
>> I'm trying to access GDAL in Python and tried "sudo pip install GDAL". But
>> an error comes out. I've downloaded also the packege from the GDAL website
>> but still doesn't work. Could you please help me out? Many thanks! Roxana

I'm unsure what "downloaded also the package from the GDAL website"
means. If you activated the repo at
http://elgis.argeo.org/repos/6/elgis/x86_64/, by setting up a .repo
file the way the describe, cool. There are older versions available
from EPEL, and there's even a well organized postgis repository
described at http://postgis.net/install/ that also keeps gdal
up-to-date.

> I use gdal on SL6 not SL7, don't use python much and pip not at all,
> but I'll ty to help.
>
> Where did you get gdal from -
>         rpmquery -i gdal
> might say, if you don't know.
>
> The cpl_port.h missing error suggests that pip assumes
> you already have gdal installed (in the place it is looking
> and probably the expected version).
> Since you do have gdalinfo installed I guess that pip isn't
> looking for cpl_port.h in the right place; mine is at
>   /usr/include/gdal/cpl_port.h
> but I think from the exact error below that pip expects it at
>   /usr/include/cpl_port.h
> while there various ways of hacking a solution to this
> specific error, I'd expect they would only lead to
> the real issue causing more errors.

It suggests to *me* that Roxana has installed the gdal package, but
not the gdal-devel package that includes header files for compiling
gdal related software.

Roxana? If you have the yum repo set up, how about doing "yum install
gdal-devel" and trying again? Or given that the error was pretty
specific, you about "yum install /usr/include//cpal_port.h" ?

There is also a fabulous website at http://rpm.pbone.net/ for finding
out what RPM has a file that you're unsure of, or what third party
repository might have a newer version of a package  If I look for
"cpl_port.h" on RHEL 6, CentOS 6, and Scientific Linux 6 on that web
site, I see it in the "gdal-devel" package from lots of places. That
site is also quite useful for finding python modules, since the names
of python modules RPM's can be fairly unpredictable.

Roxana or Andrew, if you'd like my patented rant about the dangers of
using "pip install" instead of finding or building RPM's for Python
modules, ask. It's a more complex and opinionated issue for me, and I
won't burden you with it right now.

> My guess that you have installed gdal from epel,
> but not the gdal-python package that goes with it.
> Could you try
>
>         sudo yum --enablerepo=epel install gdal-python
> ?
>
>
>> PS: Here is the output from the Terminal:
>>
>> [rtesileanu@localhost ~]$ gdalinfo --version
>> GDAL 1.11.4, released 2016/01/25
>> [rtesileanu@localhost ~]$ sudo pip install GDAL=1.11.4
>> [sudo] password for rtesileanu:
>> Invalid requirement: 'GDAL=1.11.4'
>> = is not a valid operator. Did you mean == ?
>> [rtesileanu@localhost ~]$ sudo pip install GDAL==1.11.4
>> Collecting GDAL==1.11.4
>>  Could not find a version that satisfies the requirement GDAL==1.11.4
>> (from versions: 1.5.0, 1.5.2, 1.6.0, 1.6.1, 1.7.0, 1.7.1, 1.8.1, 1.9.0,
>> 1.9.1, 1.10.0, 1.11.0, 1.11.1, 1.11.2, 2.0.0, 2.0.1, 2.1.0, 2.1.3)
>> No matching distribution found for GDAL==1.11.4
>> [rtesileanu@localhost ~]$ sudo pip install GDAL==2.1.3
>> Collecting GDAL==2.1.3
>>  Using cached GDAL-2.1.3.tar.gz
>> Installing collected packages: GDAL
>>   Running setup.py install for GDAL ... error
>>    Complete output from command /usr/bin/python2 -u -c "import setuptools,
>> tokenize;__file__='/tmp/pip-build-9uzTW8/GDAL/setup.py';f=getattr(tokenize,
>> 'open', open)(__file__);code=f.read().replace('\r\n',
>> '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
>> /tmp/pip-JC4z_K-record/install-record.txt
>> --single-version-externally-managed --compile:
>>     running install
>>     running build
>>     running build_py
>>     creating build
>>     creating build/lib.linux-x86_64-2.7
>>     copying gdal.py -> build/lib.linux-x86_64-2.7
>>     copying ogr.py -> build/lib.linux-x86_64-2.7
>>     copying osr.py -> build/lib.linux-x86_64-2.7
>>     copying gdalconst.py -> build/lib.linux-x86_64-2.7
>>     copying gdalnumeric.py -> build/lib.linux-x86_64-2.7
>>     creating build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/gnm.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/gdal_array.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/gdalconst.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/__init__.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/ogr.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/osr.py -> build/lib.linux-x86_64-2.7/osgeo
>>     copying osgeo/gdal.py -> build/lib.linux-x86_64-2.7/osgeo
>>     running build_ext
>>     building 'osgeo._gdal' extension
>>     creating build/temp.linux-x86_64-2.7
>>     creating build/temp.linux-x86_64-2.7/extensions
>>     gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
>> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
>> --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
>> -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall
>> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
>> --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
>> -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I../../port -I../../gcore -I../../alg
>> -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps
>> -I/usr/include/python2.7
>> -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include -c
>> extensions/gdal_wrap.cpp -o
>> build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o
>>    extensions/gdal_wrap.cpp:3085:22: fatal error: cpl_port.h: No such file
>> or directory
>>     #include "cpl_port.h"
>>                           ^
>>     compilation terminated.
>>     error: command 'gcc' failed with exit status 1
>>
>>    ----------------------------------------
>> Command "/usr/bin/python2 -u -c "import setuptools,
>> tokenize;__file__='/tmp/pip-build-9uzTW8/GDAL/setup.py';f=getattr(tokenize,
>> 'open', open)(__file__);code=f.read().replace('\r\n',
>> '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
>> /tmp/pip-JC4z_K-record/install-record.txt
>> --single-version-externally-managed --compile" failed with error code 1 in
>> /tmp/pip-build-9uzTW8/GDAL/
>>
>

ATOM RSS1 RSS2