Why is the dependency for my Python package unavailable?

I’m writing my first Nix-expression in nixpkgs to install my own Python package:

{ buildPythonPackage, fetchPypi, stdenv }:

buildPythonPackage rec {
  pname = "vcard";
  version = "0.12.2";

  src = fetchPypi {
    inherit pname version;
    sha256 = "063b64ec0a4cff4e0f6a995cad04308524d3367a9521c2bff00daf2a430635b7";
  };

  meta = with stdenv.lib; {
    homepage = https://gitlab.com/victor-engmark/vcard;
    description = "vCard validator, class and utility functions";
    license = licenses.agpl3Plus;
    maintainers = [ maintainers.l0b0 ];
  };
}

However, nix-build --attr vcard complains:

Collecting python-dateutil (from vcard==0.12.2)
  ERROR: Could not find a version that satisfies the requirement python-dateutil (from vcard==0.12.2) (from versions: none)
ERROR: No matching distribution found for python-dateutil (from vcard==0.12.2)
builder for '/nix/store/m77wf6mpqch1m2fv4f18chihxp21g576-python3.7-vcard-0.12.2.drv' failed with exit code 1

The package builds fine both locally and in CI.

What happens when you are running nix search dateutil?

You need to add buildInputs to your expression. Check out other python packages for reference.

1 Like