0

I have been trying to install psycopg2 for a long time now on my Mac, and each time I am getting a wheel fails to build error.

I have looked everywhere and at the moment I am trying the following before installing psycopg2:

sudo apt install python3-dev postgresql postgresql-contrib python3-psycopg2 libpq-dev

But when I run this, I am getting the error:

The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt.
Please visit http://www.java.com for information on installing Java.

However, I have a new Mac and I know from posts that it does not come with Java pre-installed. I have followed different posts to install OpenJDK, and when I type in java -version I get the following:

java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

Any ideas why I am getting this Java error, even though I have Java installed?

  • I don't know psycopg2 but usually, softwares or libraries look for the Java installation path inside the JAVA_HOME environment variable. Did you add the Java Home to your environment variables? – Matteo NNZ Jul 13 '21 at 14:20

0 Answers0