0

I ran into an issue where the order of imports for fiona and shapely caused the following geos error below which happens when i import fiona before shapely. If I do the reverse all is fine. Must be something screwy on my system. Any tips?

>>> import fiona
>>> from shapely.geometry import shape

OSError: Could not find lib geos_c or load any of its variants ['/Library/Frameworks/GEOS.framework/Versions/Current/GEOS', '/opt/local/lib/libgeos_c.dylib'].

shapely.__version__ == 1.5.13

fiona.__version__ == 1.5.1

platform OSX

2
  • I can confirm that this happens for me too, since migrating to EL Capitain. I am using Anaconda for Python. Unable to post comments, so putting this here.
    – MartinT
    Feb 12, 2016 at 3:25
  • This is likely a subtlety to do with how Fiona and Shapely locate your geos. Do you know if you have different versions of geos on your system? And do you know which one of these has precedence in your system path variable?
    – songololo
    Feb 12, 2016 at 6:10

2 Answers 2

1

There's a problem between ctypes (the Python ffi module) and GEOS shared libs on OS X such that the state of the GEOS lib is corrupted when you load it again via import shapely. It's not a problem on Linux, as far as I can tell.

The Fiona wheels for macosx and Python 2.7, 3.4, and 3.5 on PyPI have statically linked GEOS libraries and won't interfere with Shapely. I recommend using them instead of Anaconda distributions until this bug is fixed.

0

Platform OS X 10.11 El whatever ,python 2.7.11 ,shapely 1.5.16

I had a similar problem when I import geo-related package inside python.

    from shapely.geometry import shape, MultiPolygon

and I had such a thing

    Failed `CDLL(/usr/local/lib/libgeos_c.dylib)`

I search a lot on Google. But for me, the problem just ends with doing this

    pip install geos 

I just need to manually install geos and that's fine

OS I also do this:

    sudo mkdir opt

to create a folder named opt under / But I am not sure if this helps. Just to let you know if manually installing geos still does not help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.