DavHau / mach-nix

Create highly reproducible python environments
MIT License
857 stars 105 forks source link

conda provider confuses dashes and underscore when resolving packages #420

Open bjornfor opened 2 years ago

bjornfor commented 2 years ago

This results in failure to create environments that pull in e.g. _libgcc_mutex, like the zip or mlir package does:

let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix/";
    ref = "refs/heads/master";
    rev = "7b0e7f6f58f7332c1b8347e2673036eada1a6998"; # 2022-03-22
  }) {};
in
  mach-nix.mkPython {
    requirements = ''
      zip
      #mlir
      #_libgcc_mutex
    '';
    providers = {
      _default = "conda/main,conda/conda-forge";
    };
  }
$ nix-build ./try-conda.nix 
[...]
The Package '-libgcc-mutex' (build: ('conda_forge', 'main')) is not available from any of the selected providers ['conda/conda-forge', 'conda/main']
 for the selected python version
[...]

Looking at https://github.com/DavHau/conda-channels I see _libgcc_mutex in there (note the underscore), which makes me think that mach-nix is missing a name.replace('_', '-') somewhere.

There are already several of those substitutions in the codebase, which explains why it displays the package in the error message with dashes instead of underscore.

jamesdbrock commented 2 years ago

I also hit this problem with the yaml package.