Opened 5 years ago

Closed 5 years ago

Last modified 5 years 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:
Cc:

Description

Hi,

problem

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 https://files.pythonhosted.org/packages/a2/fb/7a7af9ef7a35d16fa23b127abee272cfc483ca89029b73e92e93cdf36e6b/Shapely-1.6.4.post2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-2spcnx3e/shapely/setup.py", line 80, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "/tmp/pip-install-2spcnx3e/shapely/shapely/_buildcfg.py", line 248, in <module>
        geos_version_string, geos_version, geos_capi_version = _geos_version()
      File "/tmp/pip-install-2spcnx3e/shapely/shapely/_buildcfg.py", 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/libgeos_c.so.1.11.3 /trinity/shared/OCA/softs/geos-3.7-intel19/lib/libgeos.so
(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 geos_revision.h.in 
#define GEOS_REVISION "@GEOS_REVISION@"
[alainm@gemini build]$ more geos_revision.h.in 

Change History (5)

comment:1 by pramsey, 5 years ago

Milestone: 3.7.3

comment:2 by sgillies, 5 years ago

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 by sgillies, 5 years ago

Here's a workaround for now: run your python program with -O to remove that assertion. See https://docs.python.org/3/using/cmdline.html#cmdoption-o.

comment:4 by pramsey, 5 years ago

Resolution: fixed
Status: newclosed

Seems to be handled

comment:5 by dbaston, 5 years ago

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

Note: See TracTickets for help on using tickets.