2

Hoping you can help me figure this one out. I'm slogging through the Heroku 'Getting Started with Python' page where you install the necessary dependencies to run an app locally. It all works well up until the 2nd to last step, running the command virtualenv venv. I run that, then the next command, pip install -r requirements.txt --allow-all-external, and that's where I get this error:

Error: pg_config executable not found.



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

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_nickcode/psycopg2
Storing debug log for failure in /tmp/tmpb5tCeK

I don't understand why I'm getting this error. Can anyone help me make sense of it?

My version of requirements.txt:

dj-database-url==0.3.0
Django==1.8.1
django-postgrespool==0.3.0
gunicorn==19.3.0
psycopg2==2.6
SQLAlchemy==1.0.4
whitenoise==1.0.6
n1c9
  • 2,662
  • 3
  • 32
  • 52
  • Please don't use irrelevant tags; this is not at all related to Ruby on Rails. – Daniel Roseman Dec 01 '15 at 21:37
  • And there is no way you'd get that error with the requirements.txt mentioned in the linked article. You clearly have added 'psycopg' to that file. Post it here, so we can compare it. – Daniel Roseman Dec 01 '15 at 21:38
  • Edited my initial post with that information. – n1c9 Dec 01 '15 at 21:41
  • I built that file by following other, previous steps in the tutorial. The relevant part of the page linked in the OP is this: "The demo app you deployed already has a requirements.txt, and it looks ***something*** like this:" - emphasis mine. I'm guessing that the website hasn't been updated even though what gets added along when you initially build the requirements.txt file has. – n1c9 Dec 01 '15 at 21:48
  • 1
    Did you install postgresql? – John Smith Optional Dec 03 '15 at 22:06
  • ''Doh"! Submit that as an answer so I can give you the bounty, and thank you SO VERY much! – n1c9 Dec 03 '15 at 22:19

3 Answers3

2

pg_config is part of postgresql ( http://www.postgresql.org/docs/8.1/static/app-pgconfig.html ). So you need to install postgresql.

John Smith Optional
  • 22,259
  • 12
  • 43
  • 61
  • oops, says I have to wait 20 hrs to give the bounty. I won't forget, though! :) thanks again. – n1c9 Dec 04 '15 at 01:08
2
brew install postgresql

resolves this issue on macOS

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ashwani Garg
  • 1,479
  • 1
  • 16
  • 22
0

I have overcame this issue defining a environment variable HEROKU and putting the following lines at the end of settings.py

if config('HEROKU', cast=bool, default=False):
    import django_heroku

    django_heroku.settings(locals())

As Heroku use the buildpack: heroku/python, there is no additional configuration to perform