mach-nix icon indicating copy to clipboard operation
mach-nix copied to clipboard

"Pypy not available" when building conda-forge package

Open worldofgeese opened this issue 4 years ago • 3 comments

In my default.nix I have:

let mach-nix = import (builtins.fetchGit {
  url = "https://github.com/DavHau/mach-nix";
  ref = "refs/heads/conda-beta";
    }) {
      python = "python37";
    }; in
mach-nix.mkPython {
  requirements = ''
    qcfractal
    qcengine >=0.13.0
  '';
  providers = {
    qcfractal = "conda-forge";
    qcfractal-core = "conda-forge";
    python-abi = "conda-forge";
  };
}

If I invoke nix-build default.nix, I receive the following trace:

installing 'python3-3.7.9-env'
trace: using conda channels: conda-forge, main, r
building '/nix/store/6bx3pfdal3ir1jvdlxn4c1vkpwlv0zp7-mach_nix_file.drv'...

The Package 'pypy' (build: None) is not available from any of the selected providers ['conda/main', 'conda/r', 'nixpkgs', 'sdist', 'wheel']
 for the selected python version
Traceback (most recent call last):
  File "/nix/store/y8zx05a2nvpphzqmwmjamzbm0kk15111-icr12wdpsv4babiynh0r98zmcjrdpm67-source/mach_nix/generate.py", line 106, in <module>
    main()
  File "/nix/store/y8zx05a2nvpphzqmwmjamzbm0kk15111-icr12wdpsv4babiynh0r98zmcjrdpm67-source/mach_nix/generate.py", line 99, in main
    do()
  File "/nix/store/y8zx05a2nvpphzqmwmjamzbm0kk15111-icr12wdpsv4babiynh0r98zmcjrdpm67-source/mach_nix/generate.py", line 66, in do
    expr = generator.generate(reqs)
  File "/nix/store/y8zx05a2nvpphzqmwmjamzbm0kk15111-icr12wdpsv4babiynh0r98zmcjrdpm67-source/mach_nix/generators/overides_generator.py", line 36, in generate
    pkgs = self.resolver.resolve(reqs)
  File "/nix/store/y8zx05a2nvpphzqmwmjamzbm0kk15111-icr12wdpsv4babiynh0r98zmcjrdpm67-source/mach_nix/resolver/resolvelib_resolver.py", line 51, in resolve
    result = resolvelib.Resolver(Provider(self.nixpkgs, self.deps_provider), reporter).resolve(reqs, max_rounds=1000)
  File "/nix/store/jjyn1kn5bys863ckyaw2bjyp7nyq2j7c-python3-3.7.9-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 413, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/nix/store/jjyn1kn5bys863ckyaw2bjyp7nyq2j7c-python3-3.7.9-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 323, in resolve
    raise ResolutionTooDeep(max_rounds)
resolvelib.resolvers.ResolutionTooDeep: 1000
builder for '/nix/store/6bx3pfdal3ir1jvdlxn4c1vkpwlv0zp7-mach_nix_file.drv' failed with exit code 1
error: build of '/nix/store/6bx3pfdal3ir1jvdlxn4c1vkpwlv0zp7-mach_nix_file.drv' failed
(use '--show-trace' to show detailed location information)

worldofgeese avatar Dec 17 '20 10:12 worldofgeese

When I remove the python version requirement, the package builds but the only bin results are qcengine and postgres-related binaries. The qcfractal-server binary is nowhere to be found.

worldofgeese avatar Dec 17 '20 11:12 worldofgeese

They way conda support is implemented, it uses the python interpreter from nixpkgs and therefore ignores python from conda.

I'm not sure why pypy doesn't resolve in this case. But even if it would resolve, it probably won't work, since mach-nix will still use nixpkg's python.

I'll try to debug this resolution error as soon as I find some time.

DavHau avatar Dec 18 '20 06:12 DavHau

I just ran into this error message, although the traceback did not complain about the resolution being too deep, so I'm unsure if the underlying cause is the same.

Here's a simple flake that generates the issue:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";

    mach-nix = {
      url = "github:DavHau/mach-nix/3.5.0";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-utils.follows = "flake-utils";
      inputs.pypi-deps-db.follows = "pypi-deps-db";
    };

    pypi-deps-db = {
      url = "github:DavHau/mach-nix/3.5.0";
    };
  };

  outputs = { self, nixpkgs, flake-utils, mach-nix, pypi-deps-db }:
    flake-utils.lib.eachDefaultSystem (system:
      let
      
        python = "python39";

        pkgs = import nixpkgs { inherit system python; };
        mach = import mach-nix { inherit pkgs python; };

        providers = {
          _default = "wheel,sdist,nixpkgs,conda,conda-forge";
          pygmo = "conda-forge";
        };

        fullPython = mach.mkPython {
          inherit providers;
          requirements = "pygmo";
        };

      in {
        devShell = pkgs.mkShell {
          nativeBuildInputs = [ fullPython ];
        };
      });
}

The resulting error message is:

trace: using conda channels: conda-forge, main, r
error: builder for '/nix/store/brpqqqsqwyvbfrzqxd68722086iihr1j-mach_nix_file.drv' failed with exit code 1;
       last 9 log lines:
       >
       > The Package 'pypy' (build: ()) is not available from any of the selected providers ['conda/conda-forge', 'conda/main', 'conda/r', 'nixpkgs', 'sdist', 'wheel']
       >  for the selected python version
       > The required package might just not (yet) be part of the dependency DB currently used.
       > The DB can be updated by specifying 'pypiDataRev' when importing mach-nix.
       > For examples see: https://github.com/DavHau/mach-nix/blob/master/examples.md
       > If it still doesn't work, there might have been an error while building the DB.
       > Please open an issue at: https://github.com/DavHau/mach-nix/issues/new
       >
       For full logs, run 'nix log /nix/store/brpqqqsqwyvbfrzqxd68722086iihr1j-mach_nix_file.drv'.

       … while realising the context of path '/nix/store/k5sx7w86balhmf0xy8jnwryissvys31v-mach_nix_file/share/mach_nix_file.nix'

       at /nix/store/n6hsk44fw5x8kqkff2mxyd5wd6663ai5-source/mach_nix/nix/lib.nix:180:16:

          179|       file = "${compileExpression args}/share/mach_nix_file.nix";
          180|       result = import file { inherit (args) pkgs python; };
             |                ^
          181|       manylinux =

       … while evaluating the attribute 'overrides'

       at /nix/store/n6hsk44fw5x8kqkff2mxyd5wd6663ai5-source/mach_nix/nix/lib.nix:187:7:

          186|     in {
          187|       overrides = result.overrides manylinux autoPatchelfHook;
             |       ^
          188|       select_pkgs = result.select_pkgs;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:76:22:

           75|     f: g: final: prev:
           76|       let fApplied = f final prev;
             |                      ^
           77|           prev' = prev // fApplied;

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:78:22:

           77|           prev' = prev // fApplied;
           78|       in fApplied // g final prev';
             |                      ^
           79|

       … while evaluating 'composeExtensions'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:75:18:

           74|   composeExtensions =
           75|     f: g: final: prev:
             |                  ^
           76|       let fApplied = f final prev;

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:69:67:

           68|   #
           69|   extends = f: rattrs: self: let super = rattrs self; in super // f self super;
             |                                                                   ^
           70|

       … while evaluating 'extends'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/fixed-points.nix:69:24:

           68|   #
           69|   extends = f: rattrs: self: let super = rattrs self; in super // f self super;
             |                        ^
           70|

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/customisation.nix:280:14:

          279|       spliced = extra spliced0 // spliced0 // keep self;
          280|       self = f self // {
             |              ^
          281|         newScope = scope: newScope (spliced // scope);

       … while evaluating 'makeScopeWithSplicing'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/customisation.nix:269:80:

          268|      hopefully it helps a little bit. */
          269|   makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: extra: f:
             |                                                                                ^
          270|     let

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/pkgs/development/interpreters/python/default.nix:84:12:

           83|           aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
           84|         in lib.makeScopeWithSplicing
             |            ^
           85|           pkgs.splicePackages

       … while evaluating anonymous lambda

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/pkgs/development/interpreters/python/default.nix:30:10:

           29|         # - applies overrides from `packageOverrides` and `pythonPackagesOverlays`.
           30|         ({ pkgs, stdenv, python, overrides }: let
             |          ^
           31|           pythonPackagesFun = import ../../../top-level/python-packages.nix {

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/customisation.nix:69:16:

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

       … while evaluating 'makeOverridable'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/customisation.nix:67:24:

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

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/customisation.nix:168:34:

          167|
          168|     in if missingArgs == [] then makeOverridable f allArgs else throw error;
             |                                  ^
          169|

       … while evaluating 'callPackageWith'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/lib/customisation.nix:117:35:

          116|   */
          117|   callPackageWith = autoArgs: fn: args:
             |                                   ^
          118|     let

       … from call site

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/pkgs/development/interpreters/python/default.nix:25:24:

           24|     }: let
           25|       pythonPackages = callPackage
             |                        ^
           26|         # Function that when called

       … while evaluating the attribute 'passAsFile'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-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/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-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 'nix-shell'

       at /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

gdinh avatar Sep 08 '22 17:09 gdinh