sudo apt install python3 python3-pip libpq-dev python3-psycopg2 postgresql
these are the errors I get on a new install if attempting to install without a sudo command on Ubuntu 20.04
postgres@<MACHINENAME>:~/hive-plug-play$ pip3 install -e .
Obtaining file:///var/lib/postgresql/hive-plug-play
Requirement already satisfied: aiohttp in /var/lib/postgresql/.local/lib/python3.8/site-packages (from hive-plug-play==0.2.1) (3.7.4.post0)
Requirement already satisfied: jsonrpcserver in /var/lib/postgresql/.local/lib/python3.8/site-packages (from hive-plug-play==0.2.1) (4.2.0)
Collecting psycopg2
Using cached psycopg2-2.8.6.tar.gz (383 kB)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from hive-plug-play==0.2.1) (2.22.0)
Requirement already satisfied: attrs>=17.3.0 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from aiohttp->hive-plug-play==0.2.1) (21.2.0)
Requirement already satisfied: chardet<5.0,>=2.0 in /usr/lib/python3/dist-packages (from aiohttp->hive-plug-play==0.2.1) (3.0.4)
Requirement already satisfied: yarl<2.0,>=1.0 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from aiohttp->hive-plug-play==0.2.1) (1.6.3)
Requirement already satisfied: typing-extensions>=3.6.5 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from aiohttp->hive-plug-play==0.2.1) (3.10.0.0)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from aiohttp->hive-plug-play==0.2.1) (3.0.1)
Requirement already satisfied: multidict<7.0,>=4.5 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from aiohttp->hive-plug-play==0.2.1) (5.1.0)
Requirement already satisfied: apply-defaults<1 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from jsonrpcserver->hive-plug-play==0.2.1) (0.1.4)
Requirement already satisfied: jsonschema<4,>=2 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from jsonrpcserver->hive-plug-play==0.2.1) (3.2.0)
Requirement already satisfied: idna>=2.0 in /usr/lib/python3/dist-packages (from yarl<2.0,>=1.0->aiohttp->hive-plug-play==0.2.1) (2.8)
Requirement already satisfied: pyrsistent>=0.14.0 in /var/lib/postgresql/.local/lib/python3.8/site-packages (from jsonschema<4,>=2->jsonrpcserver->hive-plug-play==0.2.1) (0.17.3)
Requirement already satisfied: six>=1.11.0 in /usr/lib/python3/dist-packages (from jsonschema<4,>=2->jsonrpcserver->hive-plug-play==0.2.1) (1.14.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from jsonschema<4,>=2->jsonrpcserver->hive-plug-play==0.2.1) (45.2.0)
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kjvyaap9/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kjvyaap9/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-sdn3zenw
cwd: /tmp/pip-install-kjvyaap9/psycopg2/
Complete output (40 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120007 -DHAVE_LO64=1 -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
36 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2, hive-plug-play
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kjvyaap9/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kjvyaap9/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o59l1obs/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/lib/postgresql/.local/include/python3.8/psycopg2
cwd: /tmp/pip-install-kjvyaap9/psycopg2/
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120007 -DHAVE_LO64=1 -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
36 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kjvyaap9/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kjvyaap9/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o59l1obs/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/lib/postgresql/.local/include/python3.8/psycopg2 Check the logs for full command output.