Forums

Using shapely.geometry

I was trying to import shapely.geometry and I hit this error:

import shapely.geometry

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "/usr/local/lib/python2.6/dist-packages/Shapely-1.2.14-py2.6-linux-x86_64.egg/shapely/geometry/init.py", line 4, in <module> from geo import box, shape, asShape, mapping

File "/usr/local/lib/python2.6/dist-packages/Shapely-1.2.14-py2.6-linux-x86_64.egg/shapely/geometry/geo.py", line 5, in <module> from point import Point, asPoint

File "/usr/local/lib/python2.6/dist-packages/Shapely-1.2.14-py2.6-linux-x86_64.egg/shapely/geometry/point.py", line 7, in <module>

from shapely.geos import lgeos, DimensionError

File "/usr/local/lib/python2.6/dist-packages/Shapely-1.2.14-py2.6-linux-x86_64.egg/shapely/geos.py", line 48, in <module>

free = load_dll('c').free

File "/usr/local/lib/python2.6/dist-packages/Shapely-1.2.14-py2.6-linux-x86_64.egg/shapely/geos.py", line 44, in load_dll libname, fallbacks or []))

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

What am I missing here? Thanks!

While waiting for an answer there are a few things you should do to narrow down the problem. 1) Try running things locally on your machine and see if you get the same error or not. 2) If you do get the same error then there is a dependency error and some required library does not exist. 3) If you don't get the same error then look at the list of libraries that shapely depends on and try to find one that is the source of the error, e.g. 'c'.

Thanks, here's what I did:

1) Yes, running the same commands locally works. 3) In the shapely code, there is a statement: lib = find_library(libname) Here, libname is 'c'. According to the Python docs, the usage of this method is such: >>> find_library("c") 'libc.so.6' libc.so exists in the /usr/lib directory which isn't a part of the PYTHONPATH. I am not able to find a solution this.

Urk. Looks like we've got a problem with ctypes find_library. We'll have a look at that next week.

Did anyone find time to look into this issue? Please do post on this thread when you do! Thanks!

Hi racheesingh -- sorry for the quietness, things were a bit hectic last week. I'll make sure we have a look this coming week.

OK, I think we have a solution that we can push into our development environment for testing; find_library on Linux uses /sbin/ldconfig, which is not available in our normal user execution environment. That's not too hard to change, so we'll try to get it into the testing environment tomorrow, which means that it should be released later this week (assuming that it doesn't break everything :-)

That's great! Thanks! :-)

OK, it's live now :-)