NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
11.47k stars 1.44k forks source link

pypy derivations produce broken pypy installation for x86_64-linux #9765

Closed jab closed 5 months ago

jab commented 5 months ago

Describe the bug

The x86_64-linux pypy installations provided by the pypy3.10 and pypy3.9 derivations are broken such that `python -m sysconfig` fails with `ModuleNotFoundError: No module named '_sysconfigdata__linux_x86_64-linux-gnu'`. This causes lots of other functionality in the standard library to fail, e.g. `python -m venv foo`, `python -m ensurepip`, etc. Click to toggle example trace from a GitHub Actions 'ubuntu-latest' runner ``` (nix:nix-shell-env) runner@fv-az1498-25:~$ pypy3.10 -VV Python 3.10.12 (af44d0b8114cb82c40a07bb9ee9c1ca8a1b3688c, Jan 03 2024, 06:33:26) [PyPy 7.3.12 with GCC 13.2.0] (nix:nix-shell-env) runner@fv-az1498-25:~$ pypy3.10 -m sysconfig Platform: "linux-x86_64" Python version: "3.10" Current installation scheme: "posix_prefix" Traceback (most recent call last): File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/runpy.py", line 199, in _run_module_as_main return _run_code(code, main_globals, None, File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/runpy.py", line 86, in _run_code exec(code, run_globals) File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/sysconfig.py", line 832, in _main() File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/sysconfig.py", line 826, in _main _print_dict('Paths', get_paths()) ^^^^^^^^^^^ File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/sysconfig.py", line 586, in get_paths return _expand_vars(scheme, vars) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/sysconfig.py", line 225, in _expand_vars _extend_dict(vars, get_config_vars()) ^^^^^^^^^^^^^^^^^ File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/sysconfig.py", line 642, in get_config_vars _init_posix(_CONFIG_VARS) File "/nix/store/m9iaqdg9qhj2qja69g0ni103ds6dax10-pypy3.10-7.3.12/pypy3.10-c/lib-python/3/sysconfig.py", line 498, in _init_posix _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named '_sysconfigdata__linux_x86_64-linux-gnu' (nix:nix-shell-env) runner@fv-az1498-25:~$ echo $? 1 ```

Steps To Reproduce

  1. nix-shell -p pypy3.10 -p pypy3.9
  2. pypy3.10 -m sysconfig
  3. See error and nonzero exit status
  4. pypy3.9 -m sysconfig
  5. See error and nonzero exit status

Expected behavior

'sysconfig' imports successfully, command exits 0

nix-env --version output

nix-env (Nix) 2.18.1

Additional context

Here is also an associated flake.lock:

{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1705175803,
        "narHash": "sha256-u+WX/r8j+jKef3IAVNWW8fznj7pn9kkaMtzjten2Qec=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "2284e61bd9df081fb2d4cc162b1d6b3d9752b02d",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

I consistently reproduce this on GitHub Actions' ubuntu-latest runners.

Locally I only have an aarch64-darwin Mac to test on where I have nix-darwin installed, and I do not reproduce this there.

Priorities

Add :+1: to issues you find important.

cole-h commented 5 months ago

This sounds less like a Nix (the package manager) issue and more like a Nixpkgs (the package set and related tooling built upon Nix-the-package-manager) issue. For Nixpkgs issues, please report them to https://github.com/NixOS/nixpkgs/issues/.