poetry2nix
poetry2nix copied to clipboard
Infinite recursion on setuptools with Poetry 1.2 beta
As of Poetry ≥ 1.2.0a1, specifically python-poetry/poetry@9a68da31b088b71f3f84868892b4940ba7e0481e (python-poetry/poetry#2826), setuptools
is no longer excluded from poetry.lock
. This apparently leads to infinite recursion on various packages that transitively depend setuptools
.
Reproduction:
$ nix-shell -p python3 --run 'python3 -mvenv venv'
$ . venv/bin/activate
$ pip install poetry==1.2.0b1
$ poetry init -n
$ poetry add --lock openapi-spec-validator==0.4.0
$ nix-build --show-trace -E '(import (fetchTarball "https://github.com/nix-community/poetry2nix/archive/master.tar.gz") {}).mkPoetryEnv { projectDir = ./.; }'
error: infinite recursion encountered
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/stdenv/generic/make-derivation.nix:240:11:
239| depsBuildBuild = lib.elemAt (lib.elemAt dependencies 0) 0;
240| nativeBuildInputs = lib.elemAt (lib.elemAt dependencies 0) 1;
| ^
241| depsBuildTarget = lib.elemAt (lib.elemAt dependencies 0) 2;
… while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.8-setuptools_scm-6.0.1'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/stdenv/generic/make-derivation.nix:201:11:
200| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
201| name =
| ^
202| let
… while evaluating the attribute 'out.outPath'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/lib/customisation.nix:156:13:
155| drvPath = assert condition; drv.${outputName}.drvPath;
156| outPath = assert condition; drv.${outputName}.outPath;
| ^
157| };
… while evaluating the attribute 'buildInputs' of the derivation 'python3.8-setuptools-62.3.2'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/stdenv/generic/make-derivation.nix:201:11:
200| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
201| name =
| ^
202| let
… while evaluating the attribute 'out.outPath'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/lib/customisation.nix:156:13:
155| drvPath = assert condition; drv.${outputName}.drvPath;
156| outPath = assert condition; drv.${outputName}.outPath;
| ^
157| };
… while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.8-toml-0.10.2'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/stdenv/generic/make-derivation.nix:201:11:
200| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
201| name =
| ^
202| let
… while evaluating the attribute 'out.outPath'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/lib/customisation.nix:156:13:
155| drvPath = assert condition; drv.${outputName}.drvPath;
156| outPath = assert condition; drv.${outputName}.outPath;
| ^
157| };
… while evaluating anonymous lambda
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/lib/lists.nix:645:24:
644| */
645| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
646|
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:67:6:
66| modules = filter hasPythonModule drvs;
67| in unique ([python] ++ modules ++ concatLists (catAttrs "requiredPythonModules" modules));
| ^
68|
… while evaluating 'requiredPythonModules'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:65:27:
64| # Get list of required Python modules given a list of derivations.
65| requiredPythonModules = drvs: let
| ^
66| modules = filter hasPythonModule drvs;
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:83:33:
82| pythonPath = [ ]; # Deprecated, for compatibility.
83| requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
| ^
84| };
… while evaluating 'requiredPythonModules'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:65:27:
64| # Get list of required Python modules given a list of derivations.
65| requiredPythonModules = drvs: let
| ^
66| modules = filter hasPythonModule drvs;
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:83:33:
82| pythonPath = [ ]; # Deprecated, for compatibility.
83| requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
| ^
84| };
… while evaluating 'requiredPythonModules'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:65:27:
64| # Get list of required Python modules given a list of derivations.
65| requiredPythonModules = drvs: let
| ^
66| modules = filter hasPythonModule drvs;
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:83:33:
82| pythonPath = [ ]; # Deprecated, for compatibility.
83| requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
| ^
84| };
… while evaluating 'requiredPythonModules'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:65:27:
64| # Get list of required Python modules given a list of derivations.
65| requiredPythonModules = drvs: let
| ^
66| modules = filter hasPythonModule drvs;
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:83:33:
82| pythonPath = [ ]; # Deprecated, for compatibility.
83| requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
| ^
84| };
… while evaluating 'requiredPythonModules'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:65:27:
64| # Get list of required Python modules given a list of derivations.
65| requiredPythonModules = drvs: let
| ^
66| modules = filter hasPythonModule drvs;
… from call site
at /nix/store/nv6f8flhigkrl9wkkjqm5rarq165zxkw-source/default.nix:251:23:
250| */
251| storePackages = requiredPythonModules (builtins.foldl' (acc: v: acc ++ v) [ ] (lib.attrValues inputAttrs));
| ^
252| in
… while evaluating the attribute 'poetryPackages'
at /nix/store/nv6f8flhigkrl9wkkjqm5rarq165zxkw-source/default.nix:255:7:
254| python = py;
255| poetryPackages = storePackages
| ^
256| ++ lib.optional hasScripts scriptsPackage
… while evaluating anonymous lambda
at /nix/store/nv6f8flhigkrl9wkkjqm5rarq165zxkw-source/default.nix:316:39:
315| in
316| poetryPython.python.withPackages (ps: envPkgs ++ (extraPackages ps));
| ^
317|
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/development/interpreters/python/with-packages.nix:3:19:
2|
3| f: let packages = f pythonPackages; in buildEnv.override { extraLibs = packages; }
| ^
… while evaluating 'requiredPythonModules'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/top-level/python-packages.nix:65:27:
64| # Get list of required Python modules given a list of derivations.
65| requiredPythonModules = drvs: let
| ^
66| modules = filter hasPythonModule drvs;
… from call site
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/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/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/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.8.11-env'
at /nix/store/nixnj684ymc0vdkh7h9qcbn9mpnd22nk-spaqrzbdjrssahhbi4808rqsg1sg0xbm-source/pkgs/stdenv/generic/make-derivation.nix:201:11:
200| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
201| name =
| ^
202| let
Also happens for version 1.1.13
when installing matplotlib 3.5.1
.
A workaround is to remove setuptools_scm
from poetry.lock
.
error: infinite recursion encountered
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/stdenv/generic/make-derivation.nix:314:7:
313| depsHostHost = lib.elemAt (lib.elemAt dependencies 1) 0;
314| buildInputs = lib.elemAt (lib.elemAt dependencies 1) 1;
| ^
315| depsTargetTarget = lib.elemAt (lib.elemAt dependencies 2) 0;
… while evaluating the attribute 'buildInputs' of the derivation 'python3.9-typing-extensions-4.2.0'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating the attribute 'out.outPath'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/lib/customisation.nix:204:13:
203| drvPath = assert condition; drv.${outputName}.drvPath;
204| outPath = assert condition; drv.${outputName}.outPath;
| ^
205| };
… while evaluating the attribute 'propagatedBuildInputs' of the derivation 'python3.9-setuptools-scm-7.0.2'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating the attribute 'out.outPath'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/lib/customisation.nix:204:13:
203| drvPath = assert condition; drv.${outputName}.drvPath;
204| outPath = assert condition; drv.${outputName}.outPath;
| ^
205| };
… while evaluating the attribute 'buildInputs' of the derivation 'python3.9-click-8.1.3'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating the attribute 'out.outPath'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/lib/customisation.nix:204:13:
203| drvPath = assert condition; drv.${outputName}.drvPath;
204| outPath = assert condition; drv.${outputName}.outPath;
| ^
205| };
… while evaluating anonymous lambda
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/lib/lists.nix:646:25:
645| */
646| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
647|
… from call site
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/top-level/python-packages.nix:62:6:
61| modules = lib.filter hasPythonModule drvs;
62| in lib.unique ([python] ++ modules ++ lib.concatLists (lib.catAttrs "requiredPythonModules" modules));
| ^
63|
… while evaluating 'requiredPythonModules'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/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/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/top-level/python-packages.nix:77:33:
76| pythonPath = [ ]; # Deprecated, for compatibility.
77| requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
| ^
78| };
… while evaluating 'requiredPythonModules'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/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/nv6f8flhigkrl9wkkjqm5rarq165zxkw-source/default.nix:251:23:
250| */
251| storePackages = requiredPythonModules (builtins.foldl' (acc: v: acc ++ v) [ ] (lib.attrValues inputAttrs));
| ^
252| in
… while evaluating the attribute 'poetryPackages'
at /nix/store/nv6f8flhigkrl9wkkjqm5rarq165zxkw-source/default.nix:255:7:
254| python = py;
255| poetryPackages = storePackages
| ^
256| ++ lib.optional hasScripts scriptsPackage
… while evaluating anonymous lambda
at /nix/store/nv6f8flhigkrl9wkkjqm5rarq165zxkw-source/default.nix:316:39:
315| in
316| poetryPython.python.withPackages (ps: envPkgs ++ (extraPackages ps));
| ^
317|
… from call site
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/development/interpreters/python/with-packages.nix:3:19:
2|
3| f: let packages = f pythonPackages; in buildEnv.override { extraLibs = packages; }
| ^
… while evaluating 'requiredPythonModules'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/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/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/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/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/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/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating the attribute 'nativeBuildInputs' of the derivation 'interactive-python3-3.9.13-environment'
at /nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
having the same issue as @vale981
I'm also having the same problem!
The poetry project sphinxcontrib-needs
pulls in setuptools_scm
, causing this infinite recursion error.
#673 fixes it for me
Seems like the recent setuptools-scm update broke something again :(
Seems like the recent setuptools-scm update broke something again :(
Indeed. Deleting setuptools
and setuptools_scm
from poetry.lock
"fixes" it.
#736 is relevant to this as well it seems :)
Fixed in #736.