Bruce
Bruce

Reputation: 585

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?

Upvotes: 6

Views: 4618

Answers (2)

rborodinov
rborodinov

Reputation: 141

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

Upvotes: 4

Tomasz Jakub Rup
Tomasz Jakub Rup

Reputation: 10680

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.

Upvotes: 1

Related Questions