Disable install checks for a python package

I’m trying to create a python environment with PyMC installed. The problem is that somewhere down the dependency tree, it tries to include tensorflow-probability which is currently broken.
After some digging I found out the offending dependency chain is pymc > pytensor > tensorflow-probability and tensorflow-probability is only a check dependency! [1]

I don’t necessarily need to run the tests and indeed setting doInstallCheck = false seems to solve the issue:

nix-repl> pkgs.python3Packages.pytensor
[...]
error: Package ‘python3.13-tensorflow-probability-0.25.0’ in /nix/store/hgdvk97xaahxgmxjb3h8svx9zrmn508c-nixos-25.11/nixos/pkgs/development/python-modules/tensorflow-probability/default.nix:144 is marked as broken, refusing to evaluate.
       
nix-repl> pkgs.python3Packages.pytensor.overrideAttrs { doInstallCheck = false; }
«derivation /nix/store/7vqjhca7lczhs733r9bgd8sla5jbmvhj-python3.13-pytensor-2.35.1.drv»

However I can’t seem to disable install checks for my shell.nix. After consulting Overriding Python packages, this is one of my best guesses on how it could work:

# shell.nix

let
  pkgs = import <nixpkgs> {};
  python = pkgs.python3.override {
    packageOverrides = self: super: {
      pytensor = super.pytensor.overrideAttrs { doInstallCheck = false; };
    };
    self = python;
  };
in pkgs.mkShell {
  packages = [
    (python.withPackages (ps: with ps; [
      jupyterlab numpy matplotlib pandas scipy pymc arviz statsmodels
    ]))
  ];
}

However when I try to run nix-shell I invariably run into the error from the broken tensorflow-probability package.

Setting NIXPKGS_ALLOW_BROKEN=1 does not help a lot. It results in a “hash mismatch” error.

Is there any way to disable install checks on the pytensor package to sidestep the broken tensorflow-probability?

[1] nixpkgs/pkgs/development/python-modules/pytensor/default.nix at d7a713c0b7e47c908258e71cba7a2d77cc8d71d5 · NixOS/nixpkgs · GitHub

You did the right thing for pytensor. You missed another module that uses tensorflow-probability:

  numpyro = super.numpyro.overrideAttrs { doInstallCheck = false; };

(The oft-maligned --show-trace output would have shown you this.)

3 Likes

You could also use lix instead of nix, since lix shows the chain of derivations that failed to eval (without needing --show-trace):

nix.package = pkgs.lix;

(Of course this will only help once you get your config rebuild, and then ideally reboot, since you’d need the nix binary to be replaced.)

Or for a one-off (untested, since I don’t use nix):

nix shell nixpkgs#lix -c nix-shell
2 Likes

Thank you! Seems like I made a bad uniqueness assumption. I will keep --show-trace in mind for the future. After some more tinkering, I now blocked the path to tensorflow-probability with

# shell.nix

let
  pkgs = import <nixpkgs> {};
  python = pkgs.python3.override {
    packageOverrides = self: super: {
      pytensor = super.pytensor.overrideAttrs { doInstallCheck = false; };
      arviz = super.arviz.overrideAttrs { doInstallCheck = false; };
    };
    self = python;
  };
in pkgs.mkShell {
  packages = [
    (python.withPackages (ps: with ps; [
      jupyterlab numpy matplotlib pandas scipy pymc arviz statsmodels
    ]))
  ];
}

But now I am faced again with the hash mismatch

error: hash mismatch in fixed-output derivation '/nix/store/a94yi5ygq8x2jp8jllvrkbbgajkgjcyx-source.drv':
         specified: sha256-j1v8MzAFfOmkN7pDcF91dS5Xprls8qfTQHWdaFUO4GU=
            got:    sha256-IPrmY1L176tuQO32U8m0NKecRNXWWmgFxIOavZgZDgQ=
error: Cannot build '/nix/store/q82har0xcv4axrbdy5417hpv8ddc0gfq-python3.13-pymc-5.26.1.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/pqz5rlvawim88ssmllkmnk3sdd16xczn-python3.13-pymc-5.26.1
         /nix/store/rg0akasxvbb0sryps4vh8rz9zj5sm7wb-python3.13-pymc-5.26.1-dist
error: Cannot build '/nix/store/rbxxr11g7zfxv701xmia7bmsbl88ksaa-python3-3.13.12-env.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/xjdxwsyhic11jbnkf05vi6x5w34mxscj-python3-3.13.12-env

This time --show-trace did not help me, but I found out that this hash is specified in pkgs.python3Packages.pymc:

buildPythonPackage rec {
  pname = "pymc";
  version = "5.26.1";
  src = fetchFromGitHub {
    owner = "pymc-devs";
    repo = "pymc";
    tag = "v${version}";
    hash = "sha256-j1v8MzAFfOmkN7pDcF91dS5Xprls8qfTQHWdaFUO4GU=";
  };
...
}

This seems somewhat concerning. Should I report this to nixpkgs?

Hmm, yes, please do. I can reproduce this with nix-build '<nixpkgs>' -A python3Packages.pymc.src.

Until it’s fixed, you can unstick yourself with even more overriding:

  pymc = super.pymc.overrideAttrs (oldAttrs: {
    src = oldAttrs.src.override {
      hash = "sha256-IPrmY1L176tuQO32U8m0NKecRNXWWmgFxIOavZgZDgQ=";
    };
  });

I reported the issue on GitHub now: Build failure: python313Packages.pymc · Issue #521907 · NixOS/nixpkgs · GitHub

Thanks for your help! I can enter my shell now :blush:

1 Like