1
votes

I'm trying to install psycopg2-binary on Mac OS Catalina and Python 3.8. The build fails always when try to install using pip3. Is there any solution for this in Catalina ?

"ERROR: Failed building wheel for psycopg2-binary"

2
Have you installed the latest setuptools with pip install —upgrade setuptoolsbjdduck
@bjdduck Yes. All done. There is a fix for Mojave, But, it's not working for Catalina.Jinto Antony
How are you installing it, exactly? When I run python3 -m pip install psycopg2-binary (using Python 3.8.0 and pip 19.2.3), it just downloads a pre-built binary; there is no local build involved.Ture Pålsson
@TurePålsson I am inside a virtualenv environment. Installing the requirements from req.txt. It was working fine in Mojave. Catalina, Is the issue, I believe.Jinto Antony

2 Answers

5
votes

I was able to compile psycopg2 on OS X 10.15.1 Catalina with $VENV/bin/pip install psycopg2 after doing a couple of things, first:

  • Re-installed xcode command line headers (though it may have just been that I accepted the new terms of service) using xcode-select --install
  • Linked homebrew ssl headers using export LDFLAGS="-L/usr/local/opt/[email protected]/lib" and export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
  • installing with $VENV/bin/pip install psycopg2 where VENV is the directory of my virtual environment

It looks like some others have had successes with just the xcode, but I also needed to add ssl things to the path.

1
votes

Try ussing the binary version:

pip install psycopg2-binary

If you still have the same issue try using Pipenv instead

and if you still cant install it in pipenv try it with the run command and the binary version:

pipenv run pip install psycopg2-binary