Search code examples
pythondjango-templatesinclude-pathgeosyandex-api

Python can't find library but pycharm can


I recently added a yandex-maps application to my django project, fulfilling all the installation instructions. However, when I try to open the page with {% load yandex_maps_tags %} tag, I get an error:

TemplateSyntaxError: 'yandex_maps_tags' is not a valid tag library: ImportError raised loading yandex_maps.templatetags.yandex_maps_tags: Could not find the GEOS library (tried "geos_c", "GEOS"). Try setting GEOS_LIBRARY_PATH in your settings.

I didn't install a custom version of GEOS library, I didn't install it at all. However, when I click on the import line in yandex-maps library and press ⌘-B, I'm taken to GEOS's library __init__.py file, which is located at /Library/Python/2.7/site-packages/django/contrib/gis/geos/__init__.py. I don't know what is supposed to be a standard path for this library, but it looks like it to me.

I'm completely lost with this error. What can I do about it?


Solution

  • In order to use django.contrib.gis.geos you need first install GEOS library. Here are the instructions.

    If you'll still have problems, see Can’t find GEOS library django docs.

    Hope that helps.