Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask-SQLAlchemy raising: AttributeError: module 'psycopg2' has no attribute 'paramstyle'

I'm running a generic (because I don't know enough to do anything beyond the basics) Flask-SQLAlchemy 3.0.2 setup on Python 3.10.

Not sure what happened, but at some point it started throwing this error every time I tried to query the db: AttributeError: module 'psycopg2' has no attribute 'paramstyle'

I'm doing package management through poetry and SQLAlchemy 1.4.44 really wanted to use psycopg2 2.7, which I guess pre-dates paramstyle.

like image 233
steadynappin Avatar asked Nov 24 '25 17:11

steadynappin


1 Answers

I uninstalled psycopg2 (and removed its requirement from the poetry lock file), and installed psycopg2-binary 2.9.5 manually. Now it works.

like image 172
steadynappin Avatar answered Nov 26 '25 07:11

steadynappin