Question

GeoDjango on App platform

I have been migrating our geodjango application from Heroku to DO App platform. I have managed to get GDAL, GEOS, and PROJ installed via Aptfile and the wheels for gdal et al build. The deployment fails on collecting static with the error that libblas.so.3 cannot be found. The build pack seems to be detecting the library paths and adding it to PATH. I am using the django.contrib.gi.db.backends.postgis as the database engine. The database is a development database in App platform. Stack trace

       Traceback (most recent call last):
         File "/workspace/manage.py", line 31, in <module>
           execute_from_command_line(sys.argv)
         File "/app/.heroku/python/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
           utility.execute()
         File "/app/.heroku/python/lib/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute
           django.setup()
         File "/app/.heroku/python/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
           apps.populate(settings.INSTALLED_APPS)
         File "/app/.heroku/python/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
           app_config.import_models()
         File "/app/.heroku/python/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
           self.models_module = import_module(models_module_name)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/importlib/__init__.py", line 126, in import_module
           return _bootstrap._gcd_import(name[level:], package, level)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
         File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
         File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
         File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
         File "<frozen importlib._bootstrap_external>", line 940, in exec_module
         File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/auth/models.py", line 3, in <module>
           from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/auth/base_user.py", line 57, in <module>
           class AbstractBaseUser(models.Model):
         File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/base.py", line 143, in __new__
           new_class.add_to_class("_meta", Options(meta, app_label))
         File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/base.py", line 371, in add_to_class
           value.contribute_to_class(cls, name)
         File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/options.py", line 243, in contribute_to_class
           self.db_table, connection.ops.max_name_length()
                          ^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/connection.py", line 15, in __getattr__
           return getattr(self._connections[self._alias], item)
                          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/connection.py", line 62, in __getitem__
           conn = self.create_connection(alias)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/site-packages/django/db/utils.py", line 193, in create_connection
           backend = load_backend(db["ENGINE"])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/site-packages/django/db/utils.py", line 113, in load_backend
           return import_module("%s.base" % backend_name)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/importlib/__init__.py", line 126, in import_module
           return _bootstrap._gcd_import(name[level:], package, level)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 7, in <module>
           from .adapter import PostGISAdapter
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/db/backends/postgis/adapter.py", line 5, in <module>
           from django.contrib.gis.geos import GEOSGeometry
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/geos/__init__.py", line 5, in <module>
           from .collections import (  # NOQA
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/geos/collections.py", line 6, in <module>
           from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/geos/geometry.py", line 8, in <module>
           from django.contrib.gis import gdal
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
           from django.contrib.gis.gdal.datasource import DataSource
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/gdal/datasource.py", line 40, in <module>
           from django.contrib.gis.gdal.driver import Driver
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
           from django.contrib.gis.gdal.prototypes import ds as vcapi
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
           from django.contrib.gis.gdal.libgdal import lgdal
         File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/gis/gdal/libgdal.py", line 71, in <module>
           lgdal = CDLL(lib_path)
                   ^^^^^^^^^^^^^^
         File "/app/.heroku/python/lib/python3.11/ctypes/__init__.py", line 376, in __init__
           self._handle = _dlopen(self._name, mode)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
       OSError: libblas.so.3: cannot open shared object file: No such file or directory

 !     Error while running '$ python manage.py collectstatic --noinput'.
       See traceback above for details.

       You may need to update application code to resolve this error.
       Or, you can disable collectstatic for this application:

          $ heroku config:set DISABLE_COLLECTSTATIC=1

       https://devcenter.heroku.com/articles/django-assets
[31;1mERROR: [0mfailed to build: exit status 1


For documentation on the buildpacks used to build your app, please see:

2024-08-01T15:13:08.597596359Z [34m│[0m    Python  v4.253.4  https://do.co/apps-buildpack-python

Aptfile

gdal-bin
libgdal-dev
proj-bin
gcc
libgeos-c1v5

Buildpack detected paths

LD_LIBRARY_PATH=/layers/digitalocean_apt/apt/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/lib:/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/usr/lib
LIBRARY_PATH=/layers/digitalocean_apt/apt/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/lib:/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/usr/lib
INCLUDE_PATH=/layers/digitalocean_apt/apt/usr/include:/layers/digitalocean_apt/apt/usr/include/x86_64-linux-gnu
CPATH=$INCLUDE_PATH
PKG_CONFIG_PATH=/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu/pkgconfig:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu/pkgconfig:/layers/digitalocean_apt/apt/usr/lib/pkgconfig

According to the apt-get output libblas3 should be installed as part of the gdal-bin apt-get installation.

Can anyone help me get this application up and running? Many thanks.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
August 7, 2024

Hey!

This is quite interesting, is your project open-source by any chance? If so can you share a link to your GitHub repository so I could try deploying this on my end and further look into it?

As far as I can tell, it seems the libblas library is missing and even though it should be installed with gdal-bin, it might not be in the right place. You could try adding it explicitly to your Aptfile:

gdal-bin
libgdal-dev
proj-bin
gcc
libgeos-c1v5
libblas3

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
Animation showing a Droplet being created in the DigitalOcean Cloud console