charles
charles

Reputation: 219

ERROR: No matching distribution found for psycopg2-binary==2.8.2

Please how should i install psycopg2-binary on my python image.

I tried pip install psycopg2-binary==2.8.2 but i got this error

ERROR: Could not find a version that satisfies the requirement psycopg2-binary==2.8.2 (from versions: 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1) ERROR: No matching distribution found for psycopg2-binary==2.8.2

My image is python3.9-alpine

What should i do please???

Upvotes: 6

Views: 10122

Answers (1)

Stefano
Stefano

Reputation: 5076

Given the amount of work that requires to be done, I suggest you use a different base image, e.g. python:3.9 or that you install the alpine package py3-psycopg2 (which is on v 2.8.6 at the time of writing).

Anyway I tried it on my machine and in the error it's also written Error: pg_config executable not found.

The pg_config is part of the postgres_dev package and needs to be installed before installing the psycopg2-binary package.

The psycopg2-binary will also need the gcc to be installed and some other libraries.

In other words, you have to execute the following commands:

apk add postgresql-dev gcc ...
pip install psycopg2-binary==2.8.2

I've abandoned the topic after I had to install a bunch of libraries.

Upvotes: 4

Related Questions