djangomacospipvirtualenv

Can't use psycopg3 on Mac?


My Django project currently uses psycopg2. When I try to switch to psycopg3, I get the following error:

OSError: cannot load library 'pango-1.0-0'

I tried upgrading pip, reinstalling pango, and I also tried starting over with a fresh virtualenv. I still get the same error. I'm using Django 4.2 with Python 3.10 on macOS 14.6 (Sonoma)


Solution

  • The issue is that glib on macOS requires python 3.12. Using a virtualenv with a different version of python will cause conflicts (due to different paths being used).