Django 4.2 + Psycopg3 issues

I’m trying to deploy a simple Django 4.2 website with psycopg-binary. It works with psycopg2-binary but for psycopg-binary I get “django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 or psycopg module” error, which implies it wasn’t installed in my virtual environment or requirements.txt file. But it’s most definitely there. Django added support for psycopg in the 4.2 release. This feels like a Fly issue unless I’m really missing something here. Have been able to reproduce several times flipping back and forth between psycopg2 and psycopg versions.

Any else having this issue? @katia

Ok, sorted this out. The installation method for binary psycopg changed slightly. Need to do python -m pip install "psycopg[binary]" now. That worked. Odd.

2 Likes

More context here: Psycopg3 Binary and Django 4.2 Installation Quick Tip | LearnDjango.com

Thanks for sharing, @wsvincent ! :slight_smile: