0
**(venv) [xxxx@rocky4 ~]$ pip install psycopg-c**
Collecting psycopg-c
  Using cached psycopg-c-3.1.9.tar.gz (538 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: psycopg-c
  Building wheel for psycopg-c (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × **Building wheel for psycopg-c (pyproject.toml) did not run successfully.
  │ exit code: 1**
  ╰─> [29 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/psycopg_c
      copying psycopg_c/__init__.py -> build/lib.linux-x86_64-cpython-39/psycopg_c
      copying psycopg_c/version.py -> build/lib.linux-x86_64-cpython-39/psycopg_c
      copying psycopg_c/py.typed -> build/lib.linux-x86_64-cpython-39/psycopg_c
      copying psycopg_c/_psycopg.pyi -> build/lib.linux-x86_64-cpython-39/psycopg_c
      copying psycopg_c/pq.pxd -> build/lib.linux-x86_64-cpython-39/psycopg_c
      creating build/lib.linux-x86_64-cpython-39/psycopg_c/_psycopg
      copying psycopg_c/_psycopg/__init__.pxd -> build/lib.linux-x86_64-cpython-39/psycopg_c/_psycopg
      copying psycopg_c/_psycopg/endian.pxd -> build/lib.linux-x86_64-cpython-39/psycopg_c/_psycopg
      copying psycopg_c/_psycopg/oids.pxd -> build/lib.linux-x86_64-cpython-39/psycopg_c/_psycopg
      creating build/lib.linux-x86_64-cpython-39/psycopg_c/pq
      copying psycopg_c/pq/__init__.pxd -> build/lib.linux-x86_64-cpython-39/psycopg_c/pq
      copying psycopg_c/pq/libpq.pxd -> build/lib.linux-x86_64-cpython-39/psycopg_c/pq
      running build_ext
      building 'psycopg_c._psycopg' extension
      creating build/temp.linux-x86_64-cpython-39
      creating build/temp.linux-x86_64-cpython-39/psycopg_c
      creating build/temp.linux-x86_64-cpython-39/psycopg_c/types
      gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/pgsql-15/include -I/home/vaijb/venv/include -I/usr/include/python3.9 -c psycopg_c/_psycopg.c -o build/temp.linux-x86_64-cpython-39/psycopg_c/_psycopg.o
     ** psycopg_c/_psycopg.c:1111:10: fatal error: pg_config.h: No such file or directory
       1111 | #include "pg_config.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]**

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psycopg-c
Failed to build psycopg-c

**ERROR**: Could not build wheels for psycopg-c, which is required to install pyproject.toml-based projects

**(venv) [xxxx@rocky4 ~]$ which gcc
**
/usr/bin/gcc

**(venv) [xxxx@rocky4 ~]$ pip install --upgrade pip**
Requirement already satisfied: pip in ./venv/lib/python3.9/site-packages (23.2.1)

OS: Rocky Linux 9.2 Python 3.9.16

Adding path of pg_config and GCC but not sure why installing psycopg-c should expect pg_config.h header file.

toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • 1
    See here [local installation](https://www.psycopg.org/psycopg3/docs/basic/install.html). psycopg builds against the Postgres dev as well as the Python dev libraries. To do that it needs pg_config. – Adrian Klaver Jul 27 '23 at 16:23

0 Answers0