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

1

6

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???

Durnan answered 25/8, 2021 at 12:9 Comment(0)
B
4

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.

Burgenland answered 25/8, 2021 at 14:6 Comment(7)
Hello @Burgenland ! Thank you for your help . I got this error apk not found when trying this line apk add postgresql-dev gcc ... i think because its debian distributionDurnan
just to be on the same page. I've executed the following: docker run -it --rm python:3.9-alpine sh. Once inside the container, I've executed apk add postgresql-dev gcc. As I wrote in the answer, the list is not complete. There's quite an amount of libraries to install as wellBurgenland
did the same and got this error bash: apk: command not foundDurnan
I don't think you did. Alpine comes without bash. You would not get that error.Burgenland
it's not an alpine distribution ? Am i wrong.?Durnan
e.g. if I execute docker run -it --rm python:3.9-alpine bash, I receive docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown.Burgenland
Let us continue this discussion in chat.Burgenland

© 2022 - 2024 — McMap. All rights reserved.