Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python GEOS ImportError

I'm getting this error:

ImportError: Could not find the GEOS library (tried ""geos_c"", ""libgeos_c-1"").  
Try setting GEOS_LIBRARY_PATH in your settings

when I run:

from django.contrib.gis.geos import *
pnt=GEOSGeometry('POINT(23 5)')
print(pnt)

I added GEOS_LIBRARY_PATH = 'C:/Python34/Lib/site-packages/osgeo/geos_c.dll'
in C:\Python34\Lib\site-packages\django\conf\project_template\project_name\settings.py

But still Im getting the same error. How to solve this?

like image 658
Bruce Avatar asked Dec 17 '15 07:12

Bruce


2 Answers

I don't know what is the most correct way to use with Windows, you can try to find solution here, but for ubuntu command:

sudo apt-get install binutils libproj-dev gdal-bin

solved the problem.

P.S. From dock:

The setting must be the full path to the C shared library; in other words you want to use libgeos_c.so, not libgeos.so.

Extension of the library must be *_c.so

like image 53
rborodinov Avatar answered Sep 27 '22 16:09

rborodinov


Are You sure path is correct? This is My path:

GEOS_LIBRARY_PATH = 'c:\\Program Files\\PostgreSQL\\9.1\\bin\\libgeos_c-1'

You need GEOS from PostgreSQL.

like image 30
Tomasz Jakub Rup Avatar answered Sep 27 '22 16:09

Tomasz Jakub Rup