Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapely 1.4.0 not working with libgeos 3.2.2 (ubuntu precise) #176

Closed
olethanh opened this issue Sep 18, 2014 · 14 comments
Closed

Shapely 1.4.0 not working with libgeos 3.2.2 (ubuntu precise) #176

olethanh opened this issue Sep 18, 2014 · 14 comments
Labels
Milestone

Comments

@olethanh
Copy link

Hello,

when using Shapely 1.4.0 with the libgeos-c1 package from Ubuntu 12.04 (precise) at version 3.2.2-3ubuntu1, I get an import error. Reverting to Shapely 1.3.0 fix the problem. The documentation mention that all version above libgeos 3.1 are supported some maybe that should be updated?

Here is the error I got:

$ python -c "import shapely.geos"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/openerp/europortetest/railfleetng/ve/local/lib/python2.7/site-packages/shapely/geos.py", line 133, in <module>
    prototype(_lgeos, geos_version)
  File "/home/openerp/europortetest/railfleetng/ve/local/lib/python2.7/site-packages/shapely/ctypes_declarations.py", line 279, in prototype
    lgeos.GEOSisClosed.restype = c_byte
  File "/usr/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libgeos_c.so.1: undefined symbol: GEOSisClosed
@mwtoews
Copy link
Member

mwtoews commented Sep 18, 2014

GEOSisClosed was added with GEOS 3.3.0 (or C API 1.7.0). This needs to be reflected in shapely/ctypes_declarations.py and other places.

@sgillies sgillies modified the milestones: Shapely 3000, 1.4.1 Sep 19, 2014
@sgillies sgillies added the bug label Sep 19, 2014
sgillies pushed a commit that referenced this issue Sep 19, 2014
Also bump version for next maint-1.4 release.
@sgillies
Copy link
Contributor

@mwtoews thanks!

@olethanh Fix coming in 1.4.1.

@sgillies
Copy link
Contributor

@olethanh Can you test for me? pip install -U git+https://github.com/Toblerity/Shapely@maint-1.4#egg=Shapely will get you the latest from the 1.4 maintenance branch (1.4.1 to be).

@sgillies sgillies reopened this Sep 19, 2014
@olethanh
Copy link
Author

Thanks @sgillies. It fixed the issue with GEOSisClosed but then fail on another symbol:

AttributeError: /usr/lib/libgeos_c.so.1: undefined symbol: GEOSGeom_getCoordinateDimension

@sgillies
Copy link
Contributor

According to Even in http://lists.osgeo.org/pipermail/gdal-dev/2011-August/029802.html, that function is in GEOS > 3.1. Git blame confirms that it goes back to 2010: https://github.com/libgeos/libgeos/blame/svn-trunk/capi/geos_c.cpp#L843.

@olethanh can you check whether a very ancient GEOS is hanging out in /usr/lib and getting in the way at runtime?

I'll close this issue, and we'll open a new one if Shapely does indeed have a problem with GEOSGeom_getCoordinateDimension.

@jwass
Copy link
Collaborator

jwass commented Sep 20, 2014

I'm pretty sure it's okay, but just want to double-check...
Does anything need to be done about speedups here?

geos_linearring_from_py calls GEOSisClosed_r in speedups.

@olethanh
Copy link
Author

Here is what I have in my /usr/lib:

-rw-r--r-- 1 root root 1367176 Dec 10  2011 libgeos-3.2.2.so
lrwxrwxrwx 1 root root      18 Dec 10  2011 libgeos_c.so.1 -> libgeos_c.so.1.6.2
-rw-r--r-- 1 root root  109568 Dec 10  2011 libgeos_c.so.1.6.2

I don't have any other libgeos on the system.

@sgillies
Copy link
Contributor

@jwass GEOS version compatibility in the speedups module is a different problem, one we need to take on eventually but not here.

@olethanh I'm stumped and don't know what to do about GEOSGeom_getCoordinateDimension being undefined in your library.

@mwtoews
Copy link
Member

mwtoews commented Sep 23, 2014

GEOSGeom_getCoordinateDimension was added with GEOS 3.3.0 (or C API 1.7.0).

I should point out that I've logged the C API changes for each GEOS release in https://github.com/mwtoews/GEOS_CAPI, so you can easily compare each release to see what has changed between versions. And as I've noted previously, use the GEOS version number, not the C API version, since it isn't reliable (#65).

@sgillies
Copy link
Contributor

thanks, @mwtoews!

@sgillies
Copy link
Contributor

@olethanh can you give the 1.4.1 release a try?

@stuartz
Copy link

stuartz commented Sep 29, 2014

I also am running into the same problem using Shapely 1.4.1 in a new virtualenv, whereas my old virtualenv with Shapely 1.2.18 works fine:

from shapely.geos import lgeos
File "/home/sjz/.virtualenvs/tg233/lib/python2.7/site-packages/Shapely-1.4.1-py2.7-linux-x86_64.egg/shapely/geos.py", line 133, in
prototype(_lgeos, geos_version)
File "/home/sjz/.virtualenvs/tg233/lib/python2.7/site-packages/Shapely-1.4.1-py2.7-linux-x86_64.egg/shapely/ctypes_declarations.py", line 279, in prototype
lgeos.GEOSisClosed.restype = c_byte
File "/usr/lib/python2.7/ctypes/init.py", line 378, in getattr
func = self.getitem(name)
File "/usr/lib/python2.7/ctypes/init.py", line 383, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libgeos_c.so.1: undefined symbol: GEOSisClosed

I also checked libgeos-c1:

sudo apt-get install libgeos-c1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgeos-c1 is already the newest version.

@sgillies
Copy link
Contributor

@stuartz Confirmed. I bungled the 1.4.1 release :( Am sorting out the maint-1.4 branch now and will upload a 1.4.2 in a few minutes.

@olethanh
Copy link
Author

olethanh commented Oct 5, 2014

Sorry I was on holiday, I'm confirming that it's now working with the latest release of shapely (1.4.3)

jorisvandenbossche added a commit to jorisvandenbossche/shapely that referenced this issue Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants