I'm trying to connect to a postgres 12.2 database from anaconda python 3.8.2 on Windows 10. I am using a conda environment with the following packages installed:
asgiref==3.2.7 certifi==2020.4.5.1 Django==3.0.4 django-crispy-forms==1.8.1 Jinja2==2.11.1 MarkupSafe==1.1.1 psycopg2==2.8.5 pytz==2019.3 sqlparse==0.3.1 wincertstore==0.2 I have created a database and I can connect using psql and pgAdmin. At the python prompt I can import psycopg2 but I get an error connecting to the database:
>>> import psycopg2 >>> c = psycopg2.connect("host='localhost' dbname='mydb' user='myuser' password='secret'") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "J:\Programs\Anaconda3\envs\myenv\lib\site-packages\psycopg2\__init__.py", line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: FATAL: unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0