Home > Blockchain >  When run `pip-compile requirements.in` in macOS12 monterey using venv python-3.9.9, pg_config not fo
When run `pip-compile requirements.in` in macOS12 monterey using venv python-3.9.9, pg_config not fo

Time:12-25

OS: monterey macOSv12.0.1 python venv: 3.9.9

requirements.in

# To update requirements.txt, run:
#
#    pip-compile requirements.in
#
# To install in localhost, run:
#
#    pip-sync requirements.txt
#

django==3.2.10  # https://www.djangoproject.com/

psycopg2-binary==2.9.2 # https://github.com/psycopg/psycopg2

After i turn on venv, then i type pip-compile requirements.in then i get a bunch of errors about pg_config not found

This is my asciinema https://asciinema.org/a/sl9MqmrayLAR3rRxEul4mYaxw

I have tried env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' pip-compile requirements.in but same.

Please advise.

CodePudding user response:

You'll need to install openssl using brew

brew install openssl
brew install postgres       # If not installed

Set the environment variables globally either temporarily by copying the below into the terminal or adding to .bashrc

export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"

You'll also need to set the path for PostgreSQL if not set

export PATH=/opt/homebrew/opt/postgresql@11/bin:$PATH

REMEMBER: Replace @___ with your version

Then proceed with requirements.txt

CodePudding user response:

It look like Postgres is not installed or Postgres /bin missing in the PATH variable

https://postgresapp.com/downloads.html

$ export PATH=/Applications/Postgres.app/Contents/Versions/<version>/bin/:$PATH

https://www.psycopg.org/docs/install.html#build-prerequisites

  • Related