pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

PEP517 build of a dependency failed

Open i34880-alt opened this issue 2 months ago • 3 comments

  • Installing pygit2 (1.18.2): Failed

PEP517 build of a dependency failed

Backend subprocess exited when trying to invoke build_wheel

| Command '['/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpl7yzzh9t/.venv/bin/python', '/Users/i34880/anacondapro/envs/batchapi_nogil/lib/python3.14/site-packages/pyproject_hooks/_in_process/_in_process.py', 'build_wheel', '/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpw79u7zqf']' returned non-zero exit status 1.
| 
| running bdist_wheel
| running build
| running build_py
| creating build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/options.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/enums.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/legacyenums.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/config.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/branches.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/submodules.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/index.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/remotes.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/references.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/packbuilder.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/credentials.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/__init__.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/_build.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/refspec.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/utils.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/blame.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/callbacks.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/settings.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/filter.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/errors.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/_run.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/repository.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/ffi.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/blob.py -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/_pygit2.pyi -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| copying pygit2/py.typed -> build/lib.macosx-12.1-arm64-cpython-314/pygit2
| creating build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/oid.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/index.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/attr.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/blame.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/pack.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/revert.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/net.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/config.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/types.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/repository.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/clone.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/callbacks.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/submodule.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/errors.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/merge.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/options.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/graph.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/describe.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/stash.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/remote.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/strarray.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/buffer.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/diff.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/common.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/proxy.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/indexer.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/refspec.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/transport.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/checkout.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| copying pygit2/decl/commit.h -> build/lib.macosx-12.1-arm64-cpython-314/pygit2/decl
| running build_ext
| generating cffi module 'build/temp.macosx-12.1-arm64-cpython-314/pygit2._libgit2.c'
| creating build/temp.macosx-12.1-arm64-cpython-314
| building 'pygit2._pygit2' extension
| creating build/temp.macosx-12.1-arm64-cpython-314/private/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpt3p7e3d_/pygit2-1.18.2/src
| clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /Users/i34880/anacondapro/envs/batchapi_nogil/include -arch arm64 -fPIC -O2 -isystem /Users/i34880/anacondapro/envs/batchapi_nogil/include -arch arm64 -I/usr/local/include -I/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpl7yzzh9t/.venv/include -I/Users/i34880/anacondapro/envs/batchapi_nogil/include/python3.14 -c /private/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpt3p7e3d_/pygit2-1.18.2/src/blob.c -o build/temp.macosx-12.1-arm64-cpython-314/private/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpt3p7e3d_/pygit2-1.18.2/src/blob.o
| /private/var/folders/6r/fy0t_cnj33g9x3zb_mmjsjg80000gp/T/tmpt3p7e3d_/pygit2-1.18.2/src/blob.c:30:10: fatal error: 'git2.h' file not found
|    30 | #include <git2.h>
|       |          ^~~~~~~~
| 1 error generated.
| error: command '/usr/bin/clang' failed with exit code 1

Note: This error originates from the build backend, and is likely not a problem with poetry but one of the following issues with pygit2 (1.18.2)

  • not supporting PEP 517 builds
  • not specifying PEP 517 build requirements correctly
  • the build requirements are incompatible with your operating system or Python version
  • the build requirements are missing system dependencies (eg: compilers, libraries, headers).

You can verify this by running pip wheel --no-cache-dir --use-pep517 "pygit2 (==1.18.2)".

i34880-alt avatar Oct 11 '25 06:10 i34880-alt

Using python 3.14

i34880-alt avatar Oct 11 '25 06:10 i34880-alt

A new release with Python 3.14 artifacts would fix this, but I think maybe free-threading support is to be finished first?

xen0n avatar Oct 13 '25 06:10 xen0n

Simple RTFM response

You need to set LIBGIT2 env var to the place where you installed libgit2 (via CMAKE_INSTALL_PREFIX option). This project's setup.py takes no responsibility in guaranteeing that libgit2 (and related deps like libssh2, openSSL, crypto) are installed/present when building from source.

This has nothing to do with PEP517 compliance. You simply did not check the docs first.

FWIW, lots of issues are raised here expecting pygit2 to have future-compatible deployments. They all don't acknowledge the complexity of building a python library that's implemented in C.

2bndy5 avatar Oct 13 '25 10:10 2bndy5