NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.64k stars 13.8k forks source link

Build failure: kikit #325220

Closed Jatsekku closed 1 month ago

Jatsekku commented 3 months ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix shell nixpkgs#kikit

Build log

Fails:

error: builder for '/nix/store/5ja7anmz71f23rp6ppmrg7l61mn89642-python3.11-shapely-1.8.5.drv' failed with exit code 1;
       last 10 log lines:
       >
       > tests/test_hash.py::test_collection
       >   /nix/store/8qyy6cj0w77g2n6rjp674fv7sjxm4xw1-python3.11-pytest-8.1.1/lib/python3.11/site-packages/_pytest/python.py:199: PytestReturnNotNoneWarning: Expected None, but tests/test_hash.py::test_collection returned True, which will be an error in a future version of pytest.  Did you mean to use `assert` instead of `return`?
       >     warnings.warn(
       >
       > -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
       > =========================== short test summary info ============================
       > FAILED tests/test_parallel_offset.py::OperationsTestCase::test_parallel_offset_linestring - AssertionError: <shapely.geometry.linestring.LineString object at 0x7ffef29...
       > ======= 1 failed, 486 passed, 1 skipped, 2 xfailed, 13 warnings in 0.78s =======
       > /nix/store/d3dzfy4amjl826fb8j00qp1d9887h7hm-stdenv-linux/setup: line 1579: pop_var_context: head of shell_variables not a function context
       For full logs, run 'nix log /nix/store/5ja7anmz71f23rp6ppmrg7l61mn89642-python3.11-shapely-1.8.5.drv'.
error: 1 dependencies of derivation '/nix/store/qrcf42xhn8vw39gakl543kxp56f76c5d-kikit-1.5.0.drv' failed to build

Additional context

Add any other context about the problem here.

Notify maintainers

@jfly @matusf

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a :+1: reaction to issues you find important.

ghpzin commented 2 months ago

shapely_1_8: https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.python311Packages.shapely_1_8.x86_64-linux

Seems like https://github.com/NixOS/nixpkgs/pull/317722 (minor bump to geos_3_11 broke it). Confirmed on current master that reverting f4e79757df1a0822d41504e504857bb3e3548d90 passes that test and builds shapely_1_8. From reading it was already discovered before in previous attempt: https://github.com/NixOS/nixpkgs/pull/240229 but now it shows up in geos_3_11 minor version bump too. Linked upstream issue about it breaking test in fedora seems to have ended with just backporting fixes to tests: https://github.com/shapely/shapely/issues/1855 cc @imincik maybe

Jatsekku commented 2 months ago

I checked it again recently, and this time it seems that wx-python is causing the problem:

[user@system:~]$ nix shell nixpkgs#kikit
error:
       … while evaluating the attribute 'drvPath'

         at /nix/store/qxf6anli54ij0q1sdlnlgx9hyl658a4v-source/lib/customisation.nix:365:7:

          364|     in commonAttrs // {
          365|       drvPath = assert condition; drv.drvPath;
             |       ^
          366|       outPath = assert condition; drv.outPath;

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: wxpython-4.2.1 not supported for interpreter python3.12
ghpzin commented 2 months ago

wxpython is related to https://github.com/NixOS/nixpkgs/pull/326142 Thought even if it is fixed shapely_1_8 still does not build according to hydra: https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.python312Packages.shapely_1_8.x86_64-linux so kikit will not either.

imincik commented 2 months ago

shapely 1.8 fixed in https://github.com/NixOS/nixpkgs/pull/331285 , please review.

imincik commented 2 months ago

I checked it again recently, and this time it seems that wx-python is causing the problem:

You can pin python to 3.11 as we did for example for grass

matusf commented 2 months ago

I tried pinning pytohn to 3.11, but then it conflicts with kicad-base which comes from kicad. nix build prints bunch of suggestion on what to do when there are conflicting versions of python. The correct one seemed to me to use the makeWrapperArgs and expose kikit as a binary. But then I get the wxpython error (not being compatible with python3.12). So I tried to force kicad to use python3.12, but nothing came out of it. I still get the same error. I don't know why it uses python3.12. Here are my changes, if anyone could point me to the right direction: https://github.com/NixOS/nixpkgs/compare/master...matusf:nixpkgs:325220-patch

`$ nix build -L .#kikit --show-trace` ``` warning: Git tree '/home/matus/code/nixos/nixpkgs' is dirty error: … while evaluating the attribute 'drvPath' at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/lib/customisation.nix:365:7: 364| in commonAttrs // { 365| drvPath = assert condition; drv.drvPath; | ^ 366| outPath = assert condition; drv.outPath; … while calling the 'derivationStrict' builtin at //builtin/derivation.nix:9:12: (source not available) … while evaluating derivation 'kikit-1.5.0' whose name attribute is located at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/pkgs/stdenv/generic/make-derivation.nix:334:7 … while evaluating attribute 'makeWrapperArgs' of derivation 'kikit-1.5.0' at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/pkgs/by-name/ki/kikit/default.nix:60:3: 59| 60| makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ kicad_ ] }" ]; | ^ 61| … from call site at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/pkgs/by-name/ki/kikit/default.nix:60:42: 59| 60| makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ kicad_ ] }" ]; | ^ 61| … while calling 'makeSearchPathOutput' at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/lib/strings.nix:510:5: 509| subDir: 510| pkgs: makeSearchPath subDir (map (lib.getOutput output) pkgs); | ^ 511| … from call site at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/lib/strings.nix:510:11: 509| subDir: 510| pkgs: makeSearchPath subDir (map (lib.getOutput output) pkgs); | ^ 511| … while calling 'makeSearchPath' at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/lib/strings.nix:468:5: 467| subDir: 468| paths: | ^ 469| concatStringsSep ":" (map (path: path + "/" + subDir) (filter (x: x != null) paths)); … while calling anonymous lambda at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/lib/strings.nix:469:32: 468| paths: 469| concatStringsSep ":" (map (path: path + "/" + subDir) (filter (x: x != null) paths)); | ^ 470| … while evaluating derivation 'kicad-base-8.0.4' whose name attribute is located at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/pkgs/stdenv/generic/make-derivation.nix:334:7 … while evaluating attribute 'buildInputs' of derivation 'kicad-base-8.0.4' at /nix/store/5jyrnb614lgma1x1hzawgrdafcdzjkj7-source/pkgs/stdenv/generic/make-derivation.nix:381:7: 380| depsHostHost = elemAt (elemAt dependencies 1) 0; 381| buildInputs = elemAt (elemAt dependencies 1) 1; | ^ 382| depsTargetTarget = elemAt (elemAt dependencies 2) 0; error: wxpython-4.2.1 not supported for interpreter python3.12 ```
jfly commented 1 month ago

@matusf, I don't think it's really possible for kicad and kikit to run on different versions of Python. Yes, it's true that the kikit cli application (pkgs/by-name/ki/kikit/package.nix) could run on a different version of python than kicad, but the kicad addon (pkgs/applications/science/electronics/kicad/addons/kikit.nix) needs to be able to run in the same python process as kikit itself (see how we build the shared pythonPath for kicad).

Rather than downgrade kicad to Python 3.11, I think it would be best to push @wegank's work in https://github.com/NixOS/nixpkgs/pull/326142 over the finish line. I believe it's very close to being in a mergeable state.

imincik commented 1 month ago

shapely 1.8 fixed in #331285 , please review.

Also, it would be great to unbreak shapely 1.8 which is used by kikit.

Jatsekku commented 1 month ago

Seems that there is still a problem:

$ nix shell nixpkgs#kikit
error: builder for '/nix/store/z61xja3nbn2y7cpnx0yfif0i12lq4y0d-python3.12-pcbnewtransition-0.4.1.drv' failed with exit code 1;
       last 10 log lines:
       >   File "/build/pcbnewTransition-0.4.1/versioneer.py", line 1480, in get_version
       >     return get_versions()["version"]
       >            ^^^^^^^^^^^^^^
       >   File "/build/pcbnewTransition-0.4.1/versioneer.py", line 1412, in get_versions
       >     cfg = get_config_from_root(root)
       >           ^^^^^^^^^^^^^^^^^^^^^^^^^^
       >   File "/build/pcbnewTransition-0.4.1/versioneer.py", line 342, in get_config_from_root
       >     parser = configparser.SafeConfigParser()
       >              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       > AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
       For full logs, run 'nix log /nix/store/z61xja3nbn2y7cpnx0yfif0i12lq4y0d-python3.12-pcbnewtransition-0.4.1.drv'.
error: 1 dependencies of derivation '/nix/store/2kk6j4ihhmfw69j7flf0iamxcs16wax6-kikit-1.5.0.drv' failed to build