1

This question is related to my previous two questions:

Geospatial Analytics in Python

Installing geopandas on Python 2.6

I got geopandas working by upgrading the whole system. I am having no luck with getting Fiona working, Below is the error I get when I try

[root@sandbox ~]# pip install fiona

   fiona/ogrext.c: In function ‘pyx_f_5fiona_6ogrext_14FeatureBuilder_build’:

    fiona/ogrext.c:3255: warning: assignment discards qualifiers from pointer target type
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_4start’:
    fiona/ogrext.c:8043: warning: implicit declaration of function ‘OGR_L_GetName’
    fiona/ogrext.c:8043: warning: assignment makes pointer from integer without a cast
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_14get_driver’:
    fiona/ogrext.c:8912: warning: assignment discards qualifiers from pointer target type
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_16get_schema’:
    fiona/ogrext.c:9162: warning: assignment discards qualifiers from pointer target type
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_18get_crs’:
    fiona/ogrext.c:10069: warning: assignment discards qualifiers from pointer target type
    fiona/ogrext.c:10078: warning: assignment discards qualifiers from pointer target type
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_22get_extent’:
    fiona/ogrext.c:11112: warning: passing argument 2 of ‘OGR_L_GetExtent’ from incompatible pointer type
    /usr/include/gdal/ogr_api.h:324: note: expected ‘struct OGREnvelope *’ but argument is of type ‘struct pyx_t_5fiona_6ograpi_OGREnvelope *’
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_14WritingSession_start’:
    fiona/ogrext.c:13233: warning: statement with no effect
    fiona/ogrext.c:14390: warning: assignment makes pointer from integer without a cast
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_13_listlayers’:
    fiona/ogrext.c:19743: warning: assignment makes pointer from integer without a cast
    fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_15buffer_to_virtual_file’:
    fiona/ogrext.c:19866: error: ‘VSILFILE’ undeclared (first use in this function)
    fiona/ogrext.c:19866: error: (Each undeclared identifier is reported only once
    fiona/ogrext.c:19866: error: for each function it appears in.)
    fiona/ogrext.c:19866: error: ‘pyx_v_vsi_handle’ undeclared (first use in this function)
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-oCUpd1/fiona/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-8szSWo-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-oCUpd1/fiona
Community
  • 1
  • 1
GreenThumb
  • 483
  • 1
  • 7
  • 25
  • Have you installed the requirements? _"Fiona requires Python 2.6, 2.7, 3.3, or 3.4 and GDAL/OGR 1.8+. To build from a source distribution you will need a C compiler and GDAL and Python development headers and libraries (libgdal1-dev for Debian/Ubuntu, **gdal-dev for CentOS/Fedora**)."_ – Burhan Khalid Nov 03 '15 at 05:10
  • @BurhanKhalid Python 2.6.6 python-devel-2.6.6-64.el6.x86_64 gdal-1.7.3-15.el6.x86_64 gcc is installed (gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)) Funny thing is - gdal.h - I have no clue where it comes from but it seems to be a very important file. So much so, that yum search gdal* gives me "Warning: No matches found for: gdal.h". I have also done export CPLUS_INCLUDE_PATH=/usr/include/gdal and export C_INCLUDE_PATH=/usr/include/gdal which has all the headers before compiling – GreenThumb Nov 03 '15 at 05:38
  • You need to install **gdal-dev** which will give you gdal.h; from your output you only have `gdal` installed. You also have the wrong version (1.7) where the minimum required is 1.8 – Burhan Khalid Nov 03 '15 at 05:50
  • @BurhanKhalid pip install gdal-dev gives me `Collecting gdal-dev Could not find a version that satisfies the requirement gdal-dev (from versions: ) No matching distribution found for gdal-dev` – GreenThumb Nov 03 '15 at 06:00

1 Answers1

0

Okay.. so after a week or so, this is what I did and it seems to be working

Downloaded the source from http://download.osgeo.org/gdal/ and compiled the source

Downloaded GDAL for python from https://pypi.python.org/pypi/GDAL/ and built it

I updated python to 2.7

then:

pip install fiona

pip install geopandas

GreenThumb
  • 483
  • 1
  • 7
  • 25