Django deployment error: pg_config executable not found.
I get the error below whenever I try to deploy my django project on either vercel or heroku
Error: pg_config executable not found. pg_config is required to build psycopg2 from source. Please add the directory containing pg_config to the $PATH or specify the full executable path with the option: python setup.py build_ext --pg-config /path/to/pg_config build ... or with the pg_config option in 'setup.cfg'. If you prefer to avoid building psycopg2 from source, please install the PyPI 'psycopg2-binary' package instead. For further information please check the 'doc/src/install.rst' file (also at <https://www.psycopg.org/docs/install.html>).
I had the same error when I was trying to deploy the django rest framework backend of devmaesters website. Following the steps below worked for me;
First uninstall psycopg2 completely from your project by running
pip uninstall psycopg2
Then install psycopg2 binary using
pip install psycopg2-binary
Then to update your requirements.txt file run
pip freeze > requirements.txt
Finally redeploy your project and everything should be working fine now.
Click on the button below to add a new message to this thread
Satus: OpenMessages: 1Started: 2022-05-27
Click the button below to start a new thread for your question
By using our website,