cyberdelia / heroku-geo-buildpack

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

not working with django? #35

Open aTylerRice opened 8 years ago

aTylerRice commented 8 years ago

Getting these errors. Tried pushing to a new heroku app and still getting the same error. Is this an issue with the build pack or with heroku? OSError: None/libgdal.so: cannot open shared object file: No such file or directory Error while runnning '$ python manage.py collectstatic --noinput'

remote: -----> Fetching set buildpack https://github.com/ddollar/heroku-buildpack-multi.git... done
remote: -----> Multipack app detected
remote: =====> Downloading Buildpack: https://github.com/cyberdelia/heroku-geo-buildpack.git
remote: =====> Detected Framework: geos/gdal/proj
remote:        Using geos version: 3.4.2
remote:        Using gdal version: 1.11.1
remote:        Using proj version: 4.8.0_1
remote: -----> Vendoring geo libraries done
remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-python
remote: =====> Detected Framework: Python
remote: -----> Installing dependencies with pip
remote: 
remote: -----> Preparing static assets with 'collectstatic'
remote:        Traceback (most recent call last):
remote:          File "manage.py", line 10, in <module>
remote:            execute_from_command_line(sys.argv)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
remote:            utility.execute()
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
remote:            django.setup()
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
remote:            apps.populate(settings.INSTALLED_APPS)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
remote:            app_config.import_models(all_models)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
remote:            self.models_module = import_module(models_module_name)
remote:          File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
remote:            __import__(name)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/models.py", line 40, in <module>
remote:            class Permission(models.Model):
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py", line 122, in __new__
remote:            new_class.add_to_class('_meta', Options(meta, **kwargs))
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py", line 297, in add_to_class
remote:            value.contribute_to_class(cls, name)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/options.py", line 166, in contribute_to_class
remote:            self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/db/__init__.py", line 40, in __getattr__
remote:            return getattr(connections[DEFAULT_DB_ALIAS], item)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 242, in __getitem__
remote:            backend = load_backend(db['ENGINE'])
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 108, in load_backend
remote:            return import_module('%s.base' % backend_name)
remote:          File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
remote:            __import__(name)
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 4, in <module>
remote:            from django.contrib.gis.db.backends.postgis.introspection import PostGISIntrospection
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/introspection.py", line 2, in <module>
remote:            from django.contrib.gis.gdal import OGRGeomType
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/gdal/__init__.py", line 46, in <module>
remote:            from django.contrib.gis.gdal.driver import Driver  # NOQA
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
remote:            from django.contrib.gis.gdal.prototypes import ds as capi
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 8, in <module>
remote:            from django.contrib.gis.gdal.libgdal import lgdal
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/gdal/libgdal.py", line 48, in <module>
remote:            lgdal = CDLL(lib_path)
remote:          File "/app/.heroku/python/lib/python2.7/ctypes/__init__.py", line 365, in __init__
remote:            self._handle = _dlopen(self._name, mode)
remote:        OSError: None/libgdal.so: cannot open shared object file: No such file or directory
remote: 
remote:  !     Error while runnning '$ python manage.py collectstatic --noinput'.
remote:        See traceback above for more details.
remote:        More info: http://devcenter.heroku.com/articles/django-assets
remote: 
remote:  !     Push rejected, failed to compile Multipack app
remote: 
kennethreitz commented 8 years ago

@aTylerRice can you share the relevant part of your settings.py, particularly your database engine?

Also, try running this again with $ heroku config DEBUG_COLLECTSTATIC=1. This will print out all of the environment variables available to Python at the time collectstatic is run. Please share that output, after censoring any sensitive information contianed within.

kennethreitz commented 8 years ago

This is caused by the GEOS_LIBRARY_PATH, GDAL_LIBRARY_PATH, and PROJ4_LIBRARY_PATH in your Django settings. Removing them completely will likely solve the problem.

guybowden commented 8 years ago

Same as issue #33 and #32 and probably #30

Scramblejams commented 8 years ago

Also experiencing it. Removing GEOS_LIBRARY_PATH, GDAL_LIBRARY_PATH, and PROJ4_LIBRARY_PATH from Django's settings did not resolve the issue.

kennethreitz commented 8 years ago

@Scramblejams share your traceback please!

Scramblejams commented 8 years ago

Not sure why it's abbreviated:

remote: Traceback (most recent call last): remote: OSError: /app/.heroku/vendor/lib/libgdal.so: cannot open shared object file: No such file or directory

Note that in settings.py, I added a line to print os.listdir('/app/.heroku/vendor/lib') so I could see what's in there during run_collectstatic. This is the output:

['libhashkit.so.2.0.0', 'libmemcached.so', 'pkgconfig', 'libmemcachedutil.a', 'libsasl2.la', 'libhashkit.a', 'libmemcached.la', 'libmemcachedutil.so.2.0.0', 'libmemcachedutil.la', 'libhashkit.so.2', 'libsasl2.so', 'libhashkit.la', 'libmemcached.so.11', 'libmemcached.so.11.0.0', 'libmemcachedutil.so.2', 'libsasl2.so.3.0.0', 'libsasl2.so.3', 'libmemcachedutil.so', 'libmemcached.a', 'sasl2', 'libhashkit.so']

No geo files to be seen anywhere. My buildpack definitions are:

scrambles@moist:~/dev/mycedar14test$ heroku buildpacks === mycedar14test Buildpack URLs

  1. heroku/python
  2. https://github.com/cyberdelia/heroku-geo-buildpack.git
ultimatecoder commented 8 years ago

@Scramblejams : I am facing the same problem. Please write back if you got the solution. Thanks!

woahdae commented 8 years ago

34 fixes a very similar issue with building for Ruby (probably the same issue), could you see if it fixes python as well?

Scramblejams commented 8 years ago

@ultimatecoder This problem occurred to me in the midst of a Cedar 10 -> Cedar 14 upgrade. The solution for me was to disable collectstatic, which allowed me to at least complete the upgrade to Cedar 14. Then, I reenabled collectstatic, which ran fine from that point on.