Open marvelous-benji opened 2 years ago
They provide a very useful error message:
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>).
We know:
Looking first at the link they provide (https://www.psycopg.org/docs/install.html), and specifically at the psycopg-vs-psycopg-binary section, they state:
(they give further information on the reasons why - these make sense since they have built the binary version using a stack that is particular to their build environment which may have subtle differences to other environments that the binary package may be used in)
The psycopg2-binary
docs give a similar warning: The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources.
I'm a bit reluctant to even use psycopg2-binary
in development of any application for production use due to the tenth principle of 12 factor app development (Dev/prod parity) which states: "Keep development, staging, and production as similar as possible".
I think we may want to use psycopg2-binary
for OpenCDMS Reference Implementation (for users who are experimenting and not directly using the code in production systems), but in general we need to make sure that psycopg2
can be built in each environment that we're supporting in production.
See the prerequisites in the psycopg2
docs for a broad overview and also Option 2 in this StackOverflow discussion for some guidance.
Description
I was trying to install pyscopg2 which is a database driver for posgresql. I did notice the package is available, as from the stack trace pip was able to download the package, but it does fails whenever it tries to build the package as it has some missing dependencies like: libpq-fe.h.
Running the following command:
pip install psycopg2
fails with the following error stack trace: