Skip to content

./psycopg/psycopg.h:35:10: fatal error: Python.h: File not found #2133

Description

@mbch331

When running python updater.py I keep getting this error

• Installing psycopg2 (2.9.10): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  running bdist_wheel
  running build
  running build_py
  creating build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/sql.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/_ipaddress.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/errors.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/__init__.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.linux-x86_64-cpython-310/psycopg
  x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC "-DPSYCOPG_VERSION=2.9.10 (dt dec pq3 ext lo64)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=160006 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/tmp/tmpv9rbnyy5/.venv/include -I/usr/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:35:10: fatal error: Python.h: Bestand of map bestaat niet
     35 | #include <Python.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 '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with psycopg2 (2.9.10) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "psycopg2 (==2.9.10)"'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions