Could not parse version info string “3.6.2-CAPI-1.10.2 4d2925d6”

If you have been working with GeoDjango or Geos related applications, I am sure many of you have seen this ugly error message:

File "/Users/maverick/.virtualenvs/demo/lib/python2.7/site-packages/django/contrib/gis/geos/__init__.py", line 8, in <module>

    from .libgeos import geos_version, geos_version_info  # NOQA: flake8 detects only the last __all__

  File "/Users/maverick/.virtualenvs/demo/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py", line 152, in <module>

    _verinfo = geos_version_info()

  File "/Users/maverick/.virtualenvs/demo/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py", line 147, in geos_version_info

    raise GEOSException('Could not parse version info string "%s"' % ver)

django.contrib.gis.geos.error.GEOSException: Could not parse version info string "3.6.2-CAPI-1.10.2 4d2925d6"

If you are on Django 1.11 than bump up the version to 1.11.5 and it should solve the problem. If you Django version is 1.8, than I you have couple of options, if you have Geos version 3.6.1 already installed through Brew than you can just switch the version by running the command:

brew switch geos 3.6.1

or, go to this website, https://download.osgeo.org/geos/ and download 3.6.1 version and unzip it in your preferred place. You then have to go to the unzipped folder and run the following commands one by one:

./configure

make

make install

Tada, now it should not complaint about that error again. Happy coding! 🙂