Opened 11 months ago

Closed 10 months ago

Last modified 10 months ago

#983 closed defect (fixed)

Problem with 3.7 branch and shapely

Reported by: aom Owned by: geos-devel@…
Priority: major Milestone: 3.7.3
Component: Default Version: 3.7.0
Severity: Unassigned Keywords:




Using the git 3.7 branch (which I guess provides the current 3.7.x distribution), the GEOSversion function returns:

3.7.3-CAPI-1.11.3 3.7.2-6-ge1399c2

Which makes the shapely installation fails, as it expect a "%d.%d.%d blah %d.%d.%d" format and assert otherwise:

# pip install shapely --no-binary shapely
Collecting shapely
  Using cached
    Complete output from command python egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-2spcnx3e/shapely/", line 80, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "/tmp/pip-install-2spcnx3e/shapely/shapely/", line 248, in <module>
        geos_version_string, geos_version, geos_capi_version = _geos_version()
      File "/tmp/pip-install-2spcnx3e/shapely/shapely/", line 242, in _geos_version
        assert len(res) == 2, res
    AssertionError: [('3', '7', '3'), ('1', '11', '3'), ('3', '7', '2')]

As a result, it is impossible to use that branch through the python biding.

Although it could be considered an issue with the python bidings.

To reproduce

(moonflash) 170135 13:26:30 [root@gemini ~]# more src/geosversion.c
#include <stdio.h>

extern char const *GEOSversion();

int main() {
  printf("Got %s\n", GEOSversion());
  return 0;
(moonflash) 170135 13:26:34 [root@gemini ~]# icc ./src/geosversion.c /trinity/shared/OCA/softs/geos-3.7-intel19/lib/ /trinity/shared/OCA/softs/geos-3.7-intel19/lib/
(moonflash) 170135 13:26:38 [root@gemini ~]# ./a.out 
Got 3.7.3-CAPI-1.11.3 3.7.2-6-ge1399c2
(moonflash) 170135 13:26:40 [root@gemini ~]#

Possible cause

In that branch, the current definition of GEOSversion

const char* GEOSversion()
  static char version[256];
  sprintf(version, "%s " GEOS_REVISION, GEOS_CAPI_VERSION);
  return version;

And GEOS_REVISION contains more than the git revision:

[alainm@gemini build]$ more geos_revision.h
#define GEOS_REVISION "3.7.2-6-ge1399c2"
[alainm@gemini build]$ more 
[alainm@gemini build]$ more 

Change History (5)

comment:1 Changed 11 months ago by pramsey

Milestone: 3.7.3

comment:2 Changed 10 months ago by sgillies

I've changed Shapely to make it more tolerant. But you'll have to use Shapely's master branch. The 1.7 release is a ways out yet.

comment:3 Changed 10 months ago by sgillies

Here's a workaround for now: run your python program with -O to remove that assertion. See

comment:4 Changed 10 months ago by pramsey

Resolution: fixed
Status: newclosed

Seems to be handled

comment:5 Changed 10 months ago by dbaston

Well, is there an issue with GEOS not producing consistent version strings?

Note: See TracTickets for help on using tickets.