Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion on setuptools with Poetry 1.2 beta #648

Closed
andersk opened this issue May 26, 2022 · 8 comments
Closed

Infinite recursion on setuptools with Poetry 1.2 beta #648

andersk opened this issue May 26, 2022 · 8 comments

Comments

@andersk
Copy link
Contributor

andersk commented May 26, 2022

As of Poetry ≥ 1.2.0a1, specifically python-poetry/poetry@9a68da3 (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
@vale981
Copy link
Contributor

vale981 commented Jun 23, 2022

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

@ezemtsov
Copy link

having the same issue as @vale981

@arpd
Copy link

arpd commented Jun 24, 2022

I'm also having the same problem!
The poetry project sphinxcontrib-needs pulls in setuptools_scm, causing this infinite recursion error.

@vale981
Copy link
Contributor

vale981 commented Jun 29, 2022

#673 fixes it for me

@K900
Copy link
Contributor

K900 commented Sep 27, 2022

Seems like the recent setuptools-scm update broke something again :(

@vale981
Copy link
Contributor

vale981 commented Sep 28, 2022

Seems like the recent setuptools-scm update broke something again :(

Indeed. Deleting setuptools and setuptools_scm from poetry.lock "fixes" it.

@SemMulder
Copy link
Contributor

#736 is relevant to this as well it seems :)

@cpcloud
Copy link
Collaborator

cpcloud commented Oct 7, 2022

Fixed in #736.

@cpcloud cpcloud closed this as completed Oct 7, 2022
l0b0 added a commit to linz/geostore that referenced this issue Oct 17, 2022
kodiakhq bot pushed a commit to linz/geostore that referenced this issue Oct 17, 2022
* build(deps): bump urllib3 from 1.26.5 to 1.26.12

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.5 to 1.26.12.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@1.26.5...1.26.12)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: Remove mention of setuptools

Temporary workaround for
<nix-community/poetry2nix#648>.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Victor Engmark <vengmark@linz.govt.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants