Shapely and Python 2.7 ctypes

Alex Rudy alex.rudy at
Sun Aug 19 21:53:57 PDT 2012


I'm trying to use Shapely with python 2.7 on mountain lion, and I seem to
be having trouble with the GEOS library and python ctypes in macports:

In [1]: import shapely.geos
OSError                                   Traceback (most recent call last)
<ipython-input-3-298ab485fd08> in <module>()
----> 1 import shapely.geos

lib/python2.7/site-packages/shapely/ in <module>()
     58     ]
     59     _lgeos = load_dll('geos_c', fallbacks=alt_paths)
---> 60     free = load_dll('c').free
     61     free.argtypes = [c_void_p]
     62     free.restype = None

lib/python2.7/site-packages/shapely/ in load_dll(libname, fallbacks)
     42         raise OSError(
     43             "Could not find library %s or load any of its variants
%s" % (
---> 44                 libname, fallbacks or []))
     46 if sys.platform.startswith('linux'):

OSError: Could not find library c or load any of its variants []

This suggests that the macports Shapely cannot find libc on my system. Is
there an issue with my new version of Xcode? I've tried cleaning,
uninstalling and re-installing Shapely and GEOS, and other python things
seem to work.

I've tried:
- xcode-select for the new Xcode (and accepting the Xcode license!)
- re-installing python27
- re-installing GEOS and Shapely

Any ideas?

(If this isn't the right place, and I need to ask the Shapely developer,
let me know, but it feels like a MacPorts/Mountain Lion problem with libc)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list