Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#17212 closed Bug (fixed)

django.contrib.gis.geos.error.GEOSException: Could not parse version info string "3.4.0dev-CAPI-1.8.0"

Reported by: strk@… Owned by: nobody
Component: GIS Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


Can't use the module with a development version of GEOS, due the version string parser chocking.

  File "/home/strk/.virtualenvs/qgis_django/lib/python2.6/site-packages/django/contrib/gis/geos/", line 113, in geos_version_info

Actual version is 1.3.1-final

Attachments (1)

geos-dev.patch (687 bytes) - added by strk@… 11 years ago.
The patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by strk@…

For the record, here's my string: "3.4.0dev-CAPI-1.8.0"

Changed 11 years ago by strk@…

Attachment: geos-dev.patch added

The patch

comment:2 Changed 11 years ago by strk@…

Has patch: set

comment:3 Changed 11 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

Looks good to me.

Generally, each patch must include tests, but in this case, I sounds overkill. I'll defer to the GIS maintainer to decide.

comment:4 Changed 11 years ago by Aymeric Augustin

Patch needs improvement: set

Note that you should generate your patch from the "trunk" directory to avoid ambiguities.

comment:5 Changed 10 years ago by jbronn

Resolution: fixed
Status: newclosed

In [17682]:

Fixed #17212 -- Made GEOS version regular expression more robust. Thanks, strk.

comment:6 Changed 9 years ago by nachopro@…

Hi, I have this problem from my ArchLinux last update:
GEOSException: Could not parse version info string "3.4.2-CAPI-1.8.2 r3921"

My "solution" was edit the geos_version_info function changing this line:
ver = geos_version().decode()

with this line:
ver = geos_version().decode().split(' ')[0]


comment:7 Changed 9 years ago by Claude Paroz

We have improved once again the parsing in #20036, which is in the latest 1.5 stable version and up.

comment:8 Changed 9 years ago by anonymous

So no patch for 1.4.X ?

comment:9 Changed 9 years ago by Claude Paroz

Here's a patch you should be able to manually apply to 1.4:

diff --git a/django/contrib/gis/geos/ b/django/contrib/gis/geos/
index f011208..05e5d12 100644
--- a/django/contrib/gis/geos/
+++ b/django/contrib/gis/geos/
@@ -108,8 +108,11 @@ def get_pointer_arr(n):
 geos_version.restype = c_char_p
 # Regular expression should be able to parse version strings such as
-# '3.0.0rc4-CAPI-1.3.3', '3.0.0-CAPI-1.4.1' or '3.4.0dev-CAPI-1.8.0'
-version_regex = re.compile(r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))((rc(?P<release_candidate>\d+))|dev)?-CAPI-(?P<capi_version>\d+\.\d+\.\d+)$')
+# '3.0.0rc4-CAPI-1.3.3', '3.0.0-CAPI-1.4.1', '3.4.0dev-CAPI-1.8.0' or '3.4.0dev-CAPI-1.8.0 r0'
+version_regex = re.compile(
+    r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))'
+    r'((rc(?P<release_candidate>\d+))|dev)?-CAPI-(?P<capi_version>\d+\.\d+\.\d+)( r\d+)?$'
 def geos_version_info():
     Returns a dictionary containing the various version metadata parsed from
Note: See TracTickets for help on using tickets.
Back to Top