2

I have some problems concerning geopandas and fiona when using the read_file function. Here is my traceback:

df = gpd.read_file('/Users/danqing0703/github/Land-Use-Simulation/LBS_Data_Fetching/osm_api/singapore_roads.geojson')

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-0c9777b3c6b2> in <module>()
----> 1 boros = GeoDataFrame.from_file('nybb.shp')

/Users/danqing0703/anaconda/lib/python2.7/site-packages/geopandas/geodataframe.pyc in from_file(cls, filename, **kwargs)
    159 
    160         """
--> 161         return geopandas.io.file.read_file(filename, **kwargs)
    162 
    163     @classmethod

/Users/danqing0703/anaconda/lib/python2.7/site-packages/geopandas/io/file.pyc in read_file(filename, **kwargs)
      9     opening the file.
     10     """
---> 11     import fiona
     12     bbox = kwargs.pop('bbox', None)
     13     with fiona.open(filename, **kwargs) as f:

/Users/danqing0703/anaconda/lib/python2.7/site-packages/fiona/__init__.py in <module>()
     70 from six import string_types
     71 
---> 72 from fiona.collection import Collection, BytesCollection, vsi_path
     73 from fiona._drivers import driver_count, GDALEnv, supported_drivers
     74 from fiona.odict import OrderedDict

/Users/danqing0703/anaconda/lib/python2.7/site-packages/fiona/collection.py in <module>()
      5 import sys
      6 
----> 7 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
      8 from fiona.ogrext import Session, WritingSession
      9 from fiona.ogrext import (

ImportError: dlopen(/Users/danqing0703/anaconda/lib/python2.7/site-packages/fiona/ogrext.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
  Referenced from: /usr/local/lib/libgdal.1.dylib
  Reason: Incompatible library version: libgdal.1.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
cel
  • 30,017
  • 18
  • 97
  • 117
DQ_happy
  • 505
  • 2
  • 6
  • 20
  • `conda update jpeg` could fix issue. Did you pip install `fiona`? It's linked against systems libjpeg, which is a rather bad sign. If feasible I would change to conda's version. If that's not an option you have to reinstall `fiona` with pip. – cel Oct 26 '15 at 05:16
  • See also my answer here, for more information: http://stackoverflow.com/questions/28848270/import-matplotlib-pyplot-gives-importerror-dlopen-library-not-loaded-libpng1/31892421#31892421 – cel Oct 26 '15 at 05:17
  • @cel So you suggest I following this:conda remove fiona pip uninstall fiona conda install fiona? – DQ_happy Oct 26 '15 at 05:19
  • This is what I get after the conda update jpeg $ conda update jpeg Fetching package metadata: ...... # All requested packages already installed. # packages in environment at /Users/danqing0703/anaconda: # jpeg 8d 1 – DQ_happy Oct 26 '15 at 05:20
  • yes, `pip uninstall` followed by `conda install` should work. – cel Oct 26 '15 at 05:23
  • Oh great thanks! it works! – DQ_happy Oct 26 '15 at 05:25
  • @cel Could you post this as an answer to this question? I will accept that, thanks! – DQ_happy Oct 26 '15 at 05:33

1 Answers1

2

Updating system's libjpeg broke the dynamic linking of fiona. There are two ways to deal with that:

I would prefer: pip uninstall fiona, conda install fiona

If you want to stick with pip: pip uninstall fiona, pip install fiona

For a more detailed explanation, also see my answer here:

import matplotlib.pyplot gives ImportError: dlopen(…) Library not loaded libpng15.15.dylib

Community
  • 1
  • 1
cel
  • 30,017
  • 18
  • 97
  • 117