Error loading psycopg2 module on OS Big Sur i.c.w. Apple Silicon

Viewed 1127

Try to install a Django Project on my new Apple Silicon machine with OS 11/Big Sur. When I try to run a manage.py command I get the following error:

/venv/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 29, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen({removed}/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so, 2): Symbol not found: _PQbackendPID
  Referenced from: {removed}/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so
  Expected in: flat namespace

I have postgres installed with the Postgres.app

Tried al kind go things. f.i. setting up the following symlink in /usr/local/lib

libpq.5.dylib -> /Applications/Postgres.app/Contents/Versions/latest/lib/libpq.5.13.dylib

Installing the psycopg2-binary gave me other errors.

So far, no luck. Not sure if the cause is OS11 or the new Silicon.

1 Answers
Related