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>).

 

message profile
Admin
2022-05-28

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.

Add Message

Click on the button below to add a new message to this thread

Tags

Thread detail

Satus: Open
Messages: 1Started: 2022-05-27
loading..

DEVMAESTERS

Newsletter

Services

Frontend Development |Backend Development |Full Website Development |Bootstrap Website upgrades | Website Debbugging | Website Hosting & deployment

Contact

Interested in hiring me or collaborating with me on a project, click on any of the links below to get my social media handle

Or contact me via Tel: (+234)-806-225-7480 | Email: abubakarzakari1703@gmail.com

Copywright@devmaesters.com
Privacy Policy

By using our website,
you agree that devmaesters can store cookies on your device and disclose information in accordance with our privacy policy.