Skip to content

Failed to build in Python 3.12 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolaasuni opened this issue Dec 12, 2023 · 2 comments
Closed

Failed to build in Python 3.12 #20

nicolaasuni opened this issue Dec 12, 2023 · 2 comments

Comments

@nicolaasuni
Copy link

Installation in Python 3.12 fails:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm
$ uname -a
Linux nuc 6.1.0-15-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09) x86_64 GNU/Linux
$ python3 --version
Python 3.12.1
$ python3 -m pip install --upgrade zlib-ng
Defaulting to user installation because normal site-packages is not writeable
Collecting zlib-ng
  Using cached zlib-ng-0.2.0.tar.gz (905 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: zlib-ng
  Building wheel for zlib-ng (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for zlib-ng (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/zlib_ng
      copying src/zlib_ng/gzip_ng.py -> build/lib.linux-x86_64-cpython-312/zlib_ng
      copying src/zlib_ng/__init__.py -> build/lib.linux-x86_64-cpython-312/zlib_ng
      copying src/zlib_ng/zlib_ng.pyi -> build/lib.linux-x86_64-cpython-312/zlib_ng
      copying src/zlib_ng/py.typed -> build/lib.linux-x86_64-cpython-312/zlib_ng
      creating build/lib.linux-x86_64-cpython-312/zlib_ng/zlib-ng
      copying src/zlib_ng/zlib-ng/LICENSE.md -> build/lib.linux-x86_64-cpython-312/zlib_ng/zlib-ng
      copying src/zlib_ng/zlib-ng/README.md -> build/lib.linux-x86_64-cpython-312/zlib_ng/zlib-ng
      running build_ext
      Traceback (most recent call last):
        File "/usr/local/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      Traceback (most recent call last):
        File "/usr/local/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      building 'zlib_ng.zlib_ng' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/src
      creating build/temp.linux-x86_64-cpython-312/src/zlib_ng
      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/tmp/tmpx7hk429e -I/usr/local/include/python3.12 -c src/zlib_ng/zlib_ngmodule.c -o build/temp.linux-x86_64-cpython-312/src/zlib_ng/zlib_ngmodule.o
      In file included from src/zlib_ng/zlib_ngmodule.c:8:
      /tmp/tmpx7hk429e/zlib-ng.h:39:10: fatal error: zconf-ng.h: No such file or directory
         39 | #include "zconf-ng.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 zlib-ng
Failed to build zlib-ng
ERROR: Could not build wheels for zlib-ng, which is required to install pyproject.toml-based projects

Note that cmake is actually installed:

$ python3 -m pip install --upgrade cmake
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cmake in /usr/local/lib/python3.12/site-packages (3.27.9)
@rhpvorderman
Copy link
Contributor

rhpvorderman commented Dec 22, 2023

The problem is that Cmake is not properly installed in the debian system you are using: /usr/local/bin/cmake is called and this gives an error.

EDIT: 3.12 installation works just fine. I just added it to the automated test suite. #21. It is a bug in your system.

@rhpvorderman
Copy link
Contributor

Looks like I was too quick to dismiss this. Sorry.

The problem is twofold:

  1. No wheels are provided for 3.12, prompting the system to build itself.
  2. cmake is apparently a python program. When system cmake is called it calls the current python in path. This is a fault in the cmake module invoking script. It should call the python wherever the module was installed too. This is unfortunate since it is out of my hands to change it.

Problem 1 will be resolved as of release 0.3.0. As wheels for 3.12 will be produced.

Problem 2 is also fixed. On linux, configure and make will be used from 0.3.0 onwards. This should preempt any annoying instances of virtual enviroments and system pythons not working nicely together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants