ekmungai / python-accounting

Python Double Entry Accounting with a focus on IFRS Compliant Reporting
MIT License
82 stars 13 forks source link

Build Failure for psycopg2 on Python 3.10 #3

Closed crissvilleda closed 7 months ago

crissvilleda commented 7 months ago

Description:

While attempting to compile psycopg2 using Python 3.10, I ran into a build error. The error message indicated that I lacked some prerequisites necessary for building the package from source. This is despite the fact that I have installed psycopg2-binary, which is the only version compatible with my environment.

Here's the error log:

copying lib/_json.py -> build/lib.linux-x86_64-cpython-310/psycopg2
      copying lib/extras.py -> build/lib.linux-x86_64-cpython-310/psycopg2
      copying lib/errorcodes.py -> build/lib.linux-x86_64-cpython-310/psycopg2
      copying lib/pool.py -> build/lib.linux-x86_64-cpython-310/psycopg2
      running build_ext
      building 'psycopg2._psycopg' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/psycopg
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC "-DPSYCOPG_VERSION=2.9.9 (dt dec pq3 ext lo64)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=160002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/home/criss/.virtualenvs/general3.10/include -I/home/criss/.pyenv/versions/3.10.11/include/python3.10 -I. -I/usr/include/postgresql -I/usr/include/postgresql/16/server -I/usr/include/libxml2 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-cpython-310/psycopg/adapter_asis.o -Wdeclaration-after-statement
      In file included from psycopg/adapter_asis.c:28:
      [./psycopg/psycopg.h:36:10](https://file+.vscode-resource.vscode-cdn.net/home/criss/coders/ML-SAT/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.
ekmungai commented 7 months ago

Hi @crissvilleda,

Could you please provide details of your environment so I can try to recreate it in a docker image?

Cheers, Edward