question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues installing because of missing pg_config

See original GitHub issue

I am trying to install contextualise on macOS 10.14.6 and Python 3.7.

/tmp
❯ virtualenv c-ize
Using base prefix '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7'
New python executable in /private/tmp/c-ize/bin/python3.7
Also creating executable in /private/tmp/c-ize/bin/python
Installing setuptools, pip, wheel...
done.

/tmp
❯ source c-ize/bin/activate

/tmp
c-ize ❯ pip3 freeze

/tmp
c-ize ❯ git clone https://github.com/brettkromkamp/contextualise
Cloning into 'contextualise'...
remote: Enumerating objects: 155, done.
remote: Counting objects: 100% (155/155), done.
remote: Compressing objects: 100% (108/108), done.
remote: Total 1133 (delta 101), reused 87 (delta 45), pack-reused 978
Receiving objects: 100% (1133/1133), 769.37 KiB | 9.05 MiB/s, done.
Resolving deltas: 100% (833/833), done.

/tmp
c-ize ❯ cd contextualise

/tmp/contextualise master
c-ize ❯ pip3 install -e .
Obtaining file:///private/tmp/contextualise
Collecting flask (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
Collecting flask-security (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/88/47/4908a5040120768ff4fb2465c7eeafeb9239c27d2919bd67c4ccc1b43e14/Flask_Security-3.0.0-py2.py3-none-any.whl
Collecting flask-sqlalchemy (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/1e/65/226d95466c75e34e291a76890ed0e27af2e46ab913002847856f11d4d59d/Flask_SQLAlchemy-2.4.1-py2.py3-none-any.whl
Collecting sqlalchemy (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/fc/49/82d64d705ced344ba458197dadab30cfa745f9650ee22260ac2b275d288c/SQLAlchemy-1.3.8.tar.gz
Collecting bcrypt (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/62/20/4c94f3f8dfc6b8720c8bc903ce2951ec6397ad864e3a64b4abdced014514/bcrypt-3.1.7-cp34-abi3-macosx_10_6_intel.whl
Collecting topic-db (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/91/e9/1a3068a8326f5dbe0bc0669b7ae5989e1e80c5bee2951aad32788bafdf8c/topic_db-1.0.0-py3-none-any.whl
Collecting maya (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/1d/56/789ebf410acc1491bf4078ef57a7a277b42c0b18f43e17007bfb6c1caaf3/maya-0.6.1-py2.py3-none-any.whl
Collecting mistune (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl
Collecting python-slugify (from contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/f5/ef/c868a9ac657405f051a8a501ac5633e769c54228716b8db7f8d717977e57/python-slugify-3.0.4.tar.gz
Collecting click>=5.1 (from flask->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting itsdangerous>=0.24 (from flask->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10.1 (from flask->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl
Collecting Werkzeug>=0.15 (from flask->contextualise==0.3.0)
  Downloading https://files.pythonhosted.org/packages/ce/42/3aeda98f96e85fd26180534d36570e4d18108d62ae36f87694b476b83d6f/Werkzeug-0.16.0-py2.py3-none-any.whl (327kB)
     |████████████████████████████████| 327kB 3.2MB/s
Collecting Flask-WTF>=0.13.1 (from flask-security->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/60/3a/58c629472d10539ae5167dc7c1fecfa95dd7d0b7864623931e3776438a24/Flask_WTF-0.14.2-py2.py3-none-any.whl
Collecting passlib>=1.7 (from flask-security->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/ee/a7/d6d238d927df355d4e4e000670342ca4705a72f0bf694027cf67d9bcf5af/passlib-1.7.1-py2.py3-none-any.whl
Collecting Flask-BabelEx>=0.9.3 (from flask-security->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/80/ad/cc2b0becd98050eed775ca85d6e5fa784547acff69f968183098df8a52b3/Flask-BabelEx-0.9.3.tar.gz
Collecting Flask-Principal>=0.3.3 (from flask-security->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/14/c7/2531aca6ab7baa3774fde2dfc9c9dd6d5a42576a1013a93701bfdc402fdd/Flask-Principal-0.4.0.tar.gz
Collecting Flask-Mail>=0.7.3 (from flask-security->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/05/2f/6a545452040c2556559779db87148d2a85e78a26f90326647b51dc5e81e9/Flask-Mail-0.9.1.tar.gz
Collecting Flask-Login>=0.3.0 (from flask-security->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/c1/ff/bd9a4d2d81bf0c07d9e53e8cd3d675c56553719bbefd372df69bf1b3c1e4/Flask-Login-0.4.1.tar.gz
Collecting cffi>=1.1 (from bcrypt->contextualise==0.3.0)
  Downloading https://files.pythonhosted.org/packages/f0/48/5aa4ea664eba26dd5142558d04762f5065c02220b4665b3f7eecb9bb614e/cffi-1.12.3-cp37-cp37m-macosx_10_9_x86_64.whl (169kB)
     |████████████████████████████████| 174kB 7.6MB/s
Collecting six>=1.4.1 (from bcrypt->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting typed-tree (from topic-db->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/12/15/5b406f42408bccd063c31465d111513f2ef25a992f58fdfcfb079ded12d7/typed_tree-1.0.3-py3-none-any.whl
Collecting psycopg2 (from topic-db->contextualise==0.3.0)
  Using cached https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /private/tmp/c-ize/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/k_/0fg5752j3vl3b814h2qyml_00000gn/T/pip-install-k4m2p3te/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/k_/0fg5752j3vl3b814h2qyml_00000gn/T/pip-install-k4m2p3te/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /private/var/folders/k_/0fg5752j3vl3b814h2qyml_00000gn/T/pip-install-k4m2p3te/psycopg2/
    Complete output (23 lines):
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

    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
    <http://initd.org/psycopg/docs/install.html>).

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

/tmp/contextualise master 8s
c-ize ❯

/tmp/contextualise master
c-ize ❯ git log
commit 1f97b45ad58de358772dafd313ce04367b2fbdd7 (HEAD -> master, origin/master, origin/develop, origin/HEAD)
Author: Brett Kromkamp <brett.kromkamp@gmail.com>
Date:   Mon Sep 23 18:44:09 2019 +0200

    Updated README.rst file.

Running pip3 install psycopg2-binary and trying the above command again does not seem to resolve the issue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
brettkromkampcommented, Oct 1, 2019

@machawk1 Yes, I agree. And, dockerizing Contextualise (#2) becomes very attractive.

0reactions
machawk1commented, Oct 1, 2019

@brettkromkamp That seems like a lot of overhead for a dependency. Despite this, contextualise may want to either describe how to accomplish it or provide some automated hooks in the build process.

When projects state, “Go to this other web page to install this dependency that you have to build from source”, it might tend to scare potential users away. Automating this down to the contextualise install will ensure building psycopg2 is less of a barrier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - pg_config executable not found - Stack Overflow
The pg_config program: it is usually installed by the libpq-dev package but sometimes it is not in a PATH directory.
Read more >
Error: pg_config executable not found | How to fix - Bobcares
Solution 1. First of all you need to install libpq-dev and python-dev ( python-dev is optional ). Then, you can run ...
Read more >
pg_config executable not found - Linux Hint
Another common cause of the pg_config executable not found error is missing dependencies. On Linux, you need to install the Python development package...
Read more >
Installing psycopg2-binary 2.8.6 complains about missing ...
running pip install psycopg2-binary Produces the following error: running ... complains about missing pg_config psycopg/psycopg2-wheels#17.
Read more >
How To Fix - "Error: pg_config executable not found" in Python
pg_config – It is installed by the libpq-dev package. But it might get missed from being added to the PATH. Get the path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found