Build gives multiple errors on pg_config
I am trying to build the course (thinkcspy) by using the build.sh file.
I get many errors like this, and have no idea what I have done incorrectly.
WARNING: Discarding https://files.pythonhosted.org/packages/9b/60/f4c79e73a69ded145880bcf4f98eeed741af12c62c5ddc89b754602b1807/psycopg2-2.5.5.tar.gz#sha256=c6c330c98ab08c5639f0ccd7e211b82b3a39f001813dcea6bb824a99d2b34fe2 (from https://pypi.org/simple/psycopg2/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached psycopg2-2.5.4.tar.gz (682 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/david/thinkcspy/.env/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q95l5zpd/psycopg2_27bb437a37d3497ea06e857020c3a188/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q95l5zpd/psycopg2_27bb437a37d3497ea06e857020c3a188/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3ghyts2v
cwd: /tmp/pip-install-q95l5zpd/psycopg2_27bb437a37d3497ea06e857020c3a188/
Complete output (14 lines):
running egg_info
creating /tmp/pip-pip-egg-info-3ghyts2v/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-3ghyts2v/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-3ghyts2v/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-3ghyts2v/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-3ghyts2v/psycopg2.egg-info/SOURCES.txt'
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'.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/63/c3/802668cb3cfc2880c2a8364623e7105a0257724a2612bb66ec733aaddb8c/psycopg2-2.5.4.tar.gz#sha256=24ba3f328aba08d8d505bc2a8f68a94ebe24a85e8483640b667221bc0efd3b1e (from https://pypi.org/simple/psycopg2/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached psycopg2-2.5.3.tar.gz (690 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/david/thinkcspy/.env/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q95l5zpd/psycopg2_618b4877df0747a1834d9863e22010d8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q95l5zpd/psycopg2_618b4877df0747a1834d9863e22010d8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_wpri8q4
cwd: /tmp/pip-install-q95l5zpd/psycopg2_618b4877df0747a1834d9863e22010d8/
Complete output (14 lines):
running egg_info
creating /tmp/pip-pip-egg-info-_wpri8q4/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-_wpri8q4/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-_wpri8q4/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-_wpri8q4/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-_wpri8q4/psycopg2.egg-info/SOURCES.txt'
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'.
Found that I have to install libpq-dev
The build now works, but the code examples do not show up when I use runestone serve, which says:
Connecting to DB
Cannot configure a Database URL!
Skipping all DB operations because environment variables not set up
Where might I get guidance on setting this up properly?
The main problem is that build.sh should have been deleted years ago... 😬
Try:
pip install -r requirements.txt
runestone build --all
The problem is it is trying to build psycopg2 rather than use psycopg2-binary in order to build psycopg2 from source you need to have the postgresql development set up. With psycopg2-binary properly installed it will do the right thing even if you do not have any database set up.