0
votes

I have python application running in docker container based on rhel7-atomic (with python36 installed). I also have separate docker container with PostgreSQL latest version (11.x). I need to install psycopg2 package in application container so it could work with PostgreSQL. But psycopg2 has libpq-dev package as dependency (http://initd.org/psycopg/docs/install.html#build-prerequisites) and I can't install it. As I saw on their page (https://pypi.org/project/libpq-dev/) they have package only available for python with version no more than 3.4 and PostgreSQL version 9.x. Of course, I can try to downgrade both python and PostgreSQL in order to try things to work (which I'm not sure will work). And it seems strange to me that libpq-dev packages are so old. Maybe I am missing something? Another way to successfully install psycopg2 package? I saw solutions for docker containers based on another OS, e.g. Error: pg_config executable not found when installing psycopg2 on Alpine in Docker. But it's not working for me.

2

2 Answers

1
votes

In case it may be helpful for others here what worked for my case. I looked through all packages containing pg_config and other stuff I needed for psycopg2 and found out that postgresql-devel would be fine. I tried it out and it worked. (Maybe later I will update answer with more details)

0
votes

You shouldn't need to downgrade Python. I have this working with Ubuntu 18 at the moment. You need to find out what package contains the libpq library on Red Hat. According to this answer, the package you need is postgresql-libs.