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

mach-nix removes dependencies from nixpkgs-package #520

Open
pawsen opened this issue Oct 20, 2022 · 1 comment
Open

mach-nix removes dependencies from nixpkgs-package #520

pawsen opened this issue Oct 20, 2022 · 1 comment

Comments

@pawsen
Copy link

pawsen commented Oct 20, 2022

When trying to install matplotlib from nixpkgs, mach-nix removes some dependencies before building.

trace: removing dependency python3.8-mock-4.0.3 from matplotlib
trace: removing dependency python3.8-pytz-2022.2.1 from matplotlib
trace: removing dependency python3.8-tornado-6.2 from matplotlib
trace: removing dependency python3.8-tkinter-3.8.15 from matplotlib
trace: removing dependency python3.8-sphinx-5.1.1 from matplotlib

which leaves me with the Agg backend and thus I'm unable to view plots. How do I prevent mach-nix from removing the dependencies?

I have the following flake.nix

{
  description = "jupyter env";
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    pypi-deps-db = {
      url = "github:DavHau/pypi-deps-db";
      flake = false;
    };
    mach-nix = {
      url = "mach-nix/3.5.0";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-utils.follows = "flake-utils";
      inputs.pypi-deps-db.follows = "pypi-deps-db";
    };
  };

  outputs = { self, nixpkgs, flake-utils, mach-nix, pypi-deps-db }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        python = "python38";
        pythonPackages = pkgs.${python + "Packages"};

        pythonEnv = mach-nix.lib."${system}".mkPython {
          python = python;
          requirements = ''
            tk
            matplotlib
          '';
          # force matplotlib to be taken from nixpkgs
          providers.matplotlib = "nixpkgs";
          # try to keep tkinter as a dependency
          _.matplotlib.propagatedBuildInputs.mod = pySelf: self: oldVal:
             oldVal ++ [ pySelf.tk ];
        };
      in
      {
        devShell = pkgs.mkShell {
          buildInputs = [
            pythonEnv
            # might be a solution - but then we need to build scipy, etc --> takes a lot of time
            # pythonPackages.matplotlib
          ];
          '';
        };
      });
}

invoked with nix develop.

If I use matplotlib from wheel (i.e. remove providers.matplotlib = "nixpkgs";), I still only have Agg as a backend.

Anyone have suggestions to how I can get matplotlib with a gui-backend?

ref
issue 330

@liubigli-tcp
Copy link

Hello! I have the same problem! Did you find any solution?

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

No branches or pull requests

2 participants