After I upgraded my brew formulae on my macbook I’m receiving this when I try to launch my code. I’m on django 4.2
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Users/tanyatree/.pyenv/versions/3.12.0/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
self.run()
File "/Users/tanyatree/.pyenv/versions/3.12.0/lib/python3.12/threading.py", line 989, in run
self._target(*self._args, **self._kwargs)
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/core/management/__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tanyatree/.pyenv/versions/3.12.0/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Users/tanyatree/git/cambio/utopia-crm-standalone/core/models.py", line 10, in <module>
from django.contrib.gis.db import models as gismodels
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
import django.contrib.gis.db.models.functions # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/db/models/functions.py", line 3, in <module>
from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/forms/fields.py", line 2, in <module>
from django.contrib.gis.gdal import GDALException
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/gdal/datasource.py", line 40, in <module>
from django.contrib.gis.gdal.driver import Driver
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import lgdal
File "/Users/tanyatree/.pyenv/versions/utopia-standalone/lib/python3.12/site-packages/django/contrib/gis/gdal/libgdal.py", line 60, in <module>
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal3.4.0", "gdal3.3.0", "gdal3.2.0", "gdal3.1.0", "gdal3.0.0", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
I’ve always had this on my settings and it never seemed to have any problem
GDAL_LIBRARY_PATH = "/opt/homebrew/opt/gdal/lib/libgdal.dylib"
GEOS_LIBRARY_PATH = "/opt/homebrew/opt/geos/lib/libgeos_c.dylib"
And I can confirm these still exist where they are. Is this a matter of versions? Brew doesn’t seem to want me to install an older version of gdal and nothing seems to be working.
Thanks for your time!