cyberdelia / heroku-geo-buildpack

Geo libraries for Heroku
https://github.com/heroku/heroku-geo-buildpack
114 stars 135 forks source link

ImportError: cannot import name GEOSException #21

Closed jdp closed 9 years ago

jdp commented 9 years ago

I'm seeing a crash on Heroku using Django 1.7.1. Here's the traceback:

$ heroku run python ./manage.py collectstatic --noinput
Running `python ./manage.py collectstatic --noinput` attached to terminal... up, run.5805
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/app/accounts/models.py", line 2, in <module>
    from django.contrib.gis.db import models
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/db/models/__init__.py", line 8, in <module>
    from django.contrib.gis.db.models.manager import GeoManager  # NOQA
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/db/models/manager.py", line 2, in <module>
    from django.contrib.gis.db.models.query import GeoQuerySet
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/db/models/query.py", line 6, in <module>
    from django.contrib.gis.db.models.fields import get_srid_info, PointField, LineStringField
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 4, in <module>
    from django.contrib.gis import forms
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/forms/__init__.py", line 2, in <module>
    from .fields import (GeometryField, GeometryCollectionField, PointField,  # NOQA
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/forms/fields.py", line 8, in <module>
    from django.contrib.gis.geos import GEOSException, GEOSGeometry
ImportError: cannot import name GEOSException

Here are the contents of my .buildpacks:

https://github.com/cyberdelia/heroku-geo-buildpack.git#1.1
https://github.com/heroku/heroku-buildpack-python.git#v52

And my requirements.txt:

Django==1.7.1
dj-database-url==0.3.0
djangorestframework==2.4.4
gunicorn==19.1.1
psycopg2==2.5.4
pysqlite==2.6.3
python-dateutil==2.2
python-mimeparse==0.1.4
six==1.8.0
whitenoise==1.0.4
wsgiref==0.1.2
cyberdelia commented 9 years ago

Could you try with the latest version of the buildpack?

jpmckinney commented 9 years ago

Latest buildpack (1.2) doesn't give me that error - I can run the following without error:

from django.contrib.gis.geos import GEOSException, GEOSGeometry

However, I am getting:

AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'

even though my DATABASES['default']['ENGINE'] is correctly set and PostGIS is installed (I can SELECT postgis_lib_version()). It's probably not a buildback issue though.

Update: Working now. The third-party package (pupa) that was running migrations seems to produce the error. Running manage.py migrate directly doesn't produce the above error.

hoIIer commented 9 years ago

Hello, I am having same problem and I tried to use the latest buildpack by following instructions on the git page but no luck, getting ImportError: cannot import name 'GEOSException'

Any suggestions?