Fiona: Ubuntu12 Python2.7 Anaconda2-4.1 Fiona1.7 listlayers() ValueError: OGR/GPX driver has not been built with read support
When I’m trying to load GPX-file using python module Fiona appears error ValueError: OGR/GPX driver has not been built with read support. Expat library required
in python
>>> fname='/home/o/jp/run.gpx'
>>> import fiona
>>> fiona.listlayers(fname)
ERROR 6: OGR/GPX driver has not been built with read support. Expat library required
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/media/disk2/ana2/lib/python2.7/site-packages/fiona/__init__.py", line 239, in listlayers
return _listlayers(vsi_path(path, vsi, archive))
File "fiona/ogrext.pyx", line 1289, in fiona.ogrext._listlayers (fiona/ogrext2.c:20494)
File "fiona/_err.pyx", line 67, in fiona._err.GDALErrCtxManager.__exit__ (fiona/_err.c:1009)
ValueError: OGR/GPX driver has not been built with read support. Expat library required
see using fiona for loading GPX-files https://ocefpaf.github.io/python4oceanographers/blog/2015/08/03/fiona_gpx/
Fiona uses GDAL https://pypi.python.org/pypi/GDAL/
I have build and install it from sourses according https://trac.osgeo.org/gdal/wiki/BuildingOnUnix ./configure --prefix=/media/disk2/gdal/
>>> fiona.__version__
'1.7.0.post2'
gdal-config --version =2.1.0
How can I fix it?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (9 by maintainers)
If this can be reproduced on another machine, someone could figure out if it a bug in GDAL, Fiona, or the installation itself. A small upload of a GPX file would be helpful. (I probably haven’t used GPX format in 3 or more years.)
Another installation test, does this print some info about successfully opening the GPX file or give an Expat error?
What is the output of ogr2ogr --formats?
“OGR/GPX driver has not been built with read support. Expat library required” is to my knowledge an error message from gdal not from fiona. As fiona points to the correct gdal installation the problem should be with your gdal installation.
Regarding Gdal 2.1, I do not know of any issues:
fiona.__gdal_version__notfiona.gdal_versionCan you check if:
I suspect you are missing the libexpat-dev package. If you have installed the libexpat manually you need to ensure that it is in the LD_LIBRARY_PATH.
This is not an issue of Fiona. The gdal you have installed has the support for the expat library not compiled in.
Maybe the gdal version of the ubuntugis ppa has expat support: https://launchpad.net/~ubuntugis Otherwise you can compile gdal with expat enabled on your own from the source code: http://trac.osgeo.org/gdal/wiki/BuildingOnUnix
Edit: I just saw that you compile from source. Do you have the libexpat-dev package installed. When you execute ./configure to install gdal you should see if the support for expat is enabled or not.