Open davidak opened 1 year ago
Maybe related: https://docs.python.org/3.12/whatsnew/3.12.html#distutils
EDIT:
The released meson version depends on distutils
which has been removed from Python 3.12. The next meson version will remove the dependency on distutils
. setuptools
embeds a copy of distutils
, thus, until the next meson version is released, you may want to install setuptools
on Python 3.12 to get the distutils
module.
Installing setuptools
is not enough, you have to import it too to let setuptools mess with sys.path
s.t. import disutils
works.
So, meson should import setuptools before importing disutils if distutils fails to import directly, and meson doesn't do this
No, it is not necessary to import setuptools
. setuptools
have some magic (details provided on request) to inject its distutils
copy in the Python path. The solution I proposed is tested. Do you have any evidence that it does not work?
I'm not an expert on how nix deals with python package installs, but the setuptools hack where sys.path
is modified through
<setuptools prefix>/lib/pythonX.Y/site-packages/distutils-precedence.pth
at startup only works when setuptools prefix == python prefix
. That is, setuptools must be installed as a system site package.
That assumption may not hold in nix, it certainly does not in the Spack package manager which like nix also puts python packages in their own prefixes, and lets python locate those through PYTHONPATH
.
So, if PYTHONPATH
is all you have, you need to import setuptools
to "activate" the same hack, s.t. import distutils
work.
Should we wait the next release that fixes this?
Another report of this error with more details. Problem is with meson It has distuils as a dependency That has been removed from Python v3.12 (nice) Have to wait for updated meson or add 'setuputils' in python.
Describe the bug
See log
``` ... Executing subproject bar Project name: bar Project version: undefined C++ compiler for the host machine: g++ (gcc 12.3.0 "g++ (GCC) 12.3.0") C++ linker for the host machine: g++ ld.bfd 2.40 C++ compiler for the build machine: g++ (gcc 12.3.0 "g++ (GCC) 12.3.0") C++ linker for the build machine: g++ ld.bfd 2.40 Could not introspect Python (['/nix/store/q5fi2vmnii9vjpqynp56vp0734yhpaig-python3-3.12.0b4/bin/python3', '/build/source/mesonbuild/scripts/python_info.py']): exit code 1 Program stdout: Program stderr: Traceback (most recent call last): File "/build/source/mesonbuild/scripts/python_info.py", line 16, inSteps To Reproduce
Steps to reproduce the behavior:
nix-shell -I nixpkgs=./ -p python312Packages.meson
Expected behavior
build successful
Additional context
the python 3.12 version of meson is not shown in the search. maybe this is known not to work. i don't see it marked as broken
https://search.nixos.org/packages?channel=unstable&show=python311Packages.meson&from=0&size=50&sort=relevance&type=packages&query=meson
Notify maintainers
@AndersonTorres
Metadata
nixpkgs @ 48992ab9b6173baa5a39f93d06c81f22c42920e8
"x86_64-linux"
Linux 6.3.8, NixOS, 22.11 (Raccoon), 22.11.4588.93fddcf640c
yes
yes
nix-env (Nix) 2.11.1
"home-manager-22.11.tar.gz, nixos-22.11, nixos-hardware, nixos-unstable"
/nix/var/nix/profiles/per-user/root/channels/nixos