nixpkgs-esp-dev icon indicating copy to clipboard operation
nixpkgs-esp-dev copied to clipboard

Esp32-C3 nix-shell error with python type checking

Open legendofa opened this issue 3 years ago • 1 comments

Hi, i am getting the following error when trying to run: nix-shell esp32c3-idf.nix.

sh building '/nix/store/lcqycb7r7d8288p1gdz3qznm5a80p1pc-py-eval-result.drv'... Traceback (most recent call last): File "<string>", line 2, in <module> File "/nix/store/da07biz6d62383s4ykbssysdalxqq3xj-python3.9-packaging-21.3/lib/python3.9/site-packages/packaging/version.py", line 42 def parse(version: str) -> Union["LegacyVersion", "Version"]: ^ SyntaxError: invalid syntax error: builder for '/nix/store/lcqycb7r7d8288p1gdz3qznm5a80p1pc-py-eval-result.drv' failed with exit code 1; last 6 log lines: > Traceback (most recent call last): > File "<string>", line 2, in <module> > File "/nix/store/da07biz6d62383s4ykbssysdalxqq3xj-python3.9-packaging-21.3/lib/python3.9/site-packages/packaging/version.py", line 42 > def parse(version: str) -> Union["LegacyVersion", "Version"]: > ^ > SyntaxError: invalid syntax For full logs, run 'nix log /nix/store/lcqycb7r7d8288p1gdz3qznm5a80p1pc-py-eval-result.drv'. (use '--show-trace' to show detailed location information)

My system info:

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.18.3, NixOS, 22.05 (Quokka), 22.05.926.8b538fcb329`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(root): `"nixos-22.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I am on commit 13ba39c98aa1a87384e35eef2e646f9b8521229a.

Full trace:

building '/nix/store/lcqycb7r7d8288p1gdz3qznm5a80p1pc-py-eval-result.drv'...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/nix/store/da07biz6d62383s4ykbssysdalxqq3xj-python3.9-packaging-21.3/lib/python3.9/site-packages/packaging/version.py", line 42
    def parse(version: str) -> Union["LegacyVersion", "Version"]:
                     ^
SyntaxError: invalid syntax
error: builder for '/nix/store/lcqycb7r7d8288p1gdz3qznm5a80p1pc-py-eval-result.drv' failed with exit code 1;
       last 6 log lines:
       > Traceback (most recent call last):
       >   File "<string>", line 2, in <module>
       >   File "/nix/store/da07biz6d62383s4ykbssysdalxqq3xj-python3.9-packaging-21.3/lib/python3.9/site-packages/packaging/version.py", line 42
       >     def parse(version: str) -> Union["LegacyVersion", "Version"]:
       >                      ^
       > SyntaxError: invalid syntax
       For full logs, run 'nix log /nix/store/lcqycb7r7d8288p1gdz3qznm5a80p1pc-py-eval-result.drv'.

       … while realising the context of path '/nix/store/rdv4dv1xj7b6zhp87vab1kaszjkljjl5-py-eval-result'

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/fixes.nix:9:29:

            8|   # evaluate arbitrary python expression and return json parsed result
            9|   py_eval = str: fromJSON ( readFile (
             |                             ^
           10|     pkgs.runCommand "py-eval-result" { buildInputs = with pkgs; [ python3 python3Packages.packaging ]; } ''

       … while evaluating 'py_eval'

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/fixes.nix:9:13:

            8|   # evaluate arbitrary python expression and return json parsed result
            9|   py_eval = str: fromJSON ( readFile (
             |             ^
           10|     pkgs.runCommand "py-eval-result" { buildInputs = with pkgs; [ python3 python3Packages.packaging ]; } ''

       … from call site

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/fixes.nix:17:30:

           16|   # return type: bool
           17|   comp_ver = ver1: op: ver2: py_eval ''
             |                              ^
           18|     import json

       … while evaluating 'comp_ver'

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/fixes.nix:17:24:

           16|   # return type: bool
           17|   comp_ver = ver1: op: ver2: py_eval ''
             |                        ^
           18|     import json

       … from call site

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/fixes.nix:67:52:

           66|   cryptography.no-rust-build = {
           67|     _cond = { prov, ver, ... }: prov == "sdist" && comp_ver ver "<" "3.4";
             |                                                    ^
           68|     nativeBuildInputs.mod = old: filterSafe (inp: (inp.name or "") != "cargo-setup-hook.sh") old;

       … while evaluating '_cond'

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/fixes.nix:67:13:

           66|   cryptography.no-rust-build = {
           67|     _cond = { prov, ver, ... }: prov == "sdist" && comp_ver ver "<" "3.4";
             |             ^
           68|     nativeBuildInputs.mod = old: filterSafe (inp: (inp.name or "") != "cargo-setup-hook.sh") old;

       … from call site

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:196:7:

          195|     in
          196|       condition { prov = provider; ver = oa.version; pyver = oa.pythonModule.version; };
             |       ^
          197|

       … while evaluating 'meets_cond'

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:192:20:

          191|
          192|   meets_cond = oa: condition:
             |                    ^
          193|     let

       … from call site

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:278:53:

          277|                 )
          278|               ) (filterAttrs (k: v: k != "_cond" && meets_cond oa cond) keys)
             |                                                     ^
          279|             );

       … while evaluating anonymous lambda

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:278:34:

          277|                 )
          278|               ) (filterAttrs (k: v: k != "_cond" && meets_cond oa cond) keys)
             |                                  ^
          279|             );

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/attrsets.nix:225:62:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          226|

       … while evaluating anonymous lambda

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/attrsets.nix:225:29:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          226|

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/attrsets.nix:225:18:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          226|

       … while evaluating 'filterAttrs'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/attrsets.nix:224:23:

          223|   */
          224|   filterAttrs = pred: set:
             |                       ^
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … from call site

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:278:18:

          277|                 )
          278|               ) (filterAttrs (k: v: k != "_cond" && meets_cond oa cond) keys)
             |                  ^
          279|             );

       … while evaluating anonymous lambda

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:263:56:

          262|           {
          263|             "${pkg}" = pySuper."${pkg}".overrideAttrs (oa:
             |                                                        ^
          264|               mapAttrs (key: val:

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:42:25:

           41|                 # arise from flipping an overlay's parameters in some cases.
           42|                 let x = f0 super;
             |                         ^
           43|                 in

       … while evaluating 'f'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:34:25:

           33|             let
           34|               f = self: super:
             |                         ^
           35|                 # Convert f0 to an overlay. Legacy is:

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:52:61:

           51|               makeDerivationExtensible mkDerivationSimple
           52|                 (self: let super = rattrs self; in super // f self super))
             |                                                             ^
           53|           args;

       … while evaluating anonymous lambda

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:52:18:

           51|               makeDerivationExtensible mkDerivationSimple
           52|                 (self: let super = rattrs self; in super // f self super))
             |                  ^
           53|           args;

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:27:14:

           26|       # An infinite recursion here can be caused by having the attribute names of expression `e` in `.overrideAttrs(finalAttrs: previousAttrs: e)` depend on `finalAttrs`. Only the attribute values of `e` can depend on `finalAttrs`.
           27|       args = rattrs (args // { inherit finalPackage; });
             |              ^
           28|       #              ^^^^

       … while evaluating 'makeDerivationExtensible'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:20:50:

           19|   # Based off lib.makeExtensible, with modifications:
           20|   makeDerivationExtensible = mkDerivationSimple: rattrs:
             |                                                  ^
           21|     let

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:51:15:

           50|             in
           51|               makeDerivationExtensible mkDerivationSimple
             |               ^
           52|                 (self: let super = rattrs self; in super // f self super))

       … while evaluating anonymous lambda

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:32:12:

           31|         mkDerivationSimple
           32|           (f0:
             |            ^
           33|             let

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:86:32:

           85|           ${if result ? overrideAttrs then "overrideAttrs" else null} = fdrv:
           86|             overrideResult (x: x.overrideAttrs fdrv);
             |                                ^
           87|         }

       … while evaluating anonymous lambda

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:86:29:

           85|           ${if result ? overrideAttrs then "overrideAttrs" else null} = fdrv:
           86|             overrideResult (x: x.overrideAttrs fdrv);
             |                             ^
           87|         }

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:79:60:

           78|       # Change the result of the function call by applying g to it
           79|       overrideResult = g: makeOverridable (copyArgs (args: g (f args))) origArgs;
             |                                                            ^
           80|     in

       … while evaluating anonymous lambda

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:79:54:

           78|       # Change the result of the function call by applying g to it
           79|       overrideResult = g: makeOverridable (copyArgs (args: g (f args))) origArgs;
             |                                                      ^
           80|     in

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:69:16:

           68|     let
           69|       result = f origArgs;
             |                ^
           70|

       … while evaluating 'makeOverridable'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:67:24:

           66|   */
           67|   makeOverridable = f: origArgs:
             |                        ^
           68|     let

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:79:27:

           78|       # Change the result of the function call by applying g to it
           79|       overrideResult = g: makeOverridable (copyArgs (args: g (f args))) origArgs;
             |                           ^
           80|     in

       … while evaluating 'overrideResult'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:79:24:

           78|       # Change the result of the function call by applying g to it
           79|       overrideResult = g: makeOverridable (copyArgs (args: g (f args))) origArgs;
             |                        ^
           80|     in

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:86:13:

           85|           ${if result ? overrideAttrs then "overrideAttrs" else null} = fdrv:
           86|             overrideResult (x: x.overrideAttrs fdrv);
             |             ^
           87|         }

       … while evaluating 'overrideAttrs'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/lib/customisation.nix:85:73:

           84|           overrideDerivation = fdrv: overrideResult (x: overrideDerivation x fdrv);
           85|           ${if result ? overrideAttrs then "overrideAttrs" else null} = fdrv:
             |                                                                         ^
           86|             overrideResult (x: x.overrideAttrs fdrv);

       … from call site

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:263:24:

          262|           {
          263|             "${pkg}" = pySuper."${pkg}".overrideAttrs (oa:
             |                        ^
          264|               mapAttrs (key: val:

       … while evaluating the attribute 'cryptography'

       at /nix/store/zkffps35qh635lbl47zr41b8q4jfmp8c-source/mach_nix/nix/lib.nix:263:13:

          262|           {
          263|             "${pkg}" = pySuper."${pkg}".overrideAttrs (oa:
             |             ^
          264|               mapAttrs (key: val:

       … while evaluating 'hasPythonModule'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/top-level/python-packages.nix:57:21:

           56|   # Check whether a derivation provides a Python module.
           57|   hasPythonModule = drv: drv?pythonModule && drv.pythonModule == python;
             |                     ^
           58|

       … from call site

       … while evaluating 'requiredPythonModules'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/top-level/python-packages.nix:60:27:

           59|   # Get list of required Python modules given a list of derivations.
           60|   requiredPythonModules = drvs: let
             |                           ^
           61|     modules = lib.filter hasPythonModule drvs;

       … from call site

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/development/interpreters/python/wrapper.nix:20:13:

           19|   env = let
           20|     paths = requiredPythonModules (extraLibs ++ [ python ] ) ;
             |             ^
           21|     pythonPath = "${placeholder "out"}/${python.sitePackages}";

       … while evaluating the attribute 'passAsFile'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/build-support/buildenv/default.nix:77:5:

           76|     # XXX: The size is somewhat arbitrary
           77|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |     ^
           78|   }

       … while evaluating the attribute 'passAsFile' of the derivation 'python3-3.9.13-env'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:278:7:

          277|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          278|       name =
             |       ^
          279|         let

       … while evaluating the attribute 'installPhase' of the derivation 'esp-idf-v4.3.1'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:278:7:

          277|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          278|       name =
             |       ^
          279|         let

       … while evaluating the attribute 'buildInputs' of the derivation 'esp-idf'

       at /nix/store/fbkb0r9pnafpyq9r43wfz8727h65pi3i-nixos-22.05/nixos/pkgs/stdenv/generic/make-derivation.nix:278:7:

          277|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          278|       name =
             |       ^
          279|         let

legendofa avatar Jun 16 '22 20:06 legendofa

I can reproduce this with:

 - system: `"x86_64-linux"`
 - host os: `Linux 5.18.0, NixOS, 22.11 (Raccoon), 22.11.20220530.f1c1676`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(root): `""`
 - nixpkgs: `/nix/store/d84iknazpzwbjbj1j9zh9wnh6v6dzlfb-source`

The flake-pinned nixpkgs (nix develop .#esp32c3-idf) works, but if I update the flake dependencies it breaks in the same way, so I'm guessing something updated in nixpkgs that breaks the mach-nix setup.

I'll see if I can fix it, but until then you can still get a working shell if you have Nix flake support with nix develop .#esp32c3-idf

mirrexagon avatar Jul 24 '22 02:07 mirrexagon

I think this is the same cause as/would be fixed by a fix for #12, so I am closing this issue and redirecting there.

mirrexagon avatar Jun 28 '23 09:06 mirrexagon

#23 should have fixed this.

mirrexagon avatar Jun 30 '23 10:06 mirrexagon