Hi,
I am trying to create a development shell in order to compile the Python package for LTX-Video. This is compiled from github like so,
# ltx-video.nix
{ pkgs, einops }:
pkgs.python312Packages.buildPythonPackage rec {
pname = "ltx-video";
version = "";
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "Lightricks";
repo = "LTX-Video";
rev = "ltx-video-0.9.1";
hash = "sha256-jHLoyAhZuMJxoY3bqCIsp1QSMo4IF4M6Fe6I5LVQtkA=";
};
nativeBuildInputs = [
pkgs.python312
];
propagatedBuildInputs = [
pkgs.python312Packages.setuptools
pkgs.python312Packages.torch
pkgs.python312Packages.diffusers
pkgs.python312Packages.transformers
pkgs.python312Packages.sentencepiece
pkgs.python312Packages.huggingface-hub
einops
];
doCheck = false;
pythonImportsCheck = [ "ltx-video" ];
}
Here, einops
is not contained in nixpkgs, and so I have for my development shell
let
einops = import ./einops.nix { inherit pkgs; };
ltx-video = import ./ltx-video.nix { inherit pkgs; inherit einops; };
in
pkgs.mkShell rec {
nativeBuildInputs = with pkgs.buildPackages; [
einops
python312Packages.numpy
[...]
ltx-video
];
}
This fails to build because LTX-Video requires a specific version of huggingface-hub
(0.25.2), but python312Packages.huggingface-hub
provides 0.26.2.
Now 0.25.2 seems nowhere to be found in nixpkgs, but it’s on PyPi, and so I can build it like so
# huggingface-hub.nix
{ pkgs }:
pkgs.python312Packages.buildPythonPackage rec {
pname = "huggingface_hub";
version = "0.25.2";
pyproject = true;
src = pkgs.python312Packages.fetchPypi {
inherit pname;
inherit version;
hash = "sha256-oQFOoRGl9AzNI/f3uorEbiD6O2WM7R+GoAx1wG7GQjw=";
};
nativeBuildInputs = [
pkgs.python312
pkgs.python312Packages.setuptools
];
propagatedBuildInputs = [
pkgs.python312Packages.filelock
pkgs.python312Packages.fsspec
pkgs.python312Packages.pyyaml
pkgs.python312Packages.requests
pkgs.python312Packages.tqdm
pkgs.python312Packages.typing-extensions
];
doCheck = false;
pythonImportsCheck = [ "huggingface_hub" ];
}
and add my own huggingface-hub.nix
at the same level as einops.nix
in my development shell. The shell correctly provides a python with 0.25.2 of huggingface-hub
, but I end up in hell in another place:
The package ltx-video depends on transformers
and diffusers
and each of them further depends on huggingface-hub
, but of course take it from python312Packages
and so use 0.26.2. That’s fine. But the buildPythonPackage
when trying to build my LTX-Video, seems to see both 0.25.2 (my own) and 0.26.2 (from the other packages) of huggingface-hub
, seems to prefer 0.26.2 and then fails because it is not 0.25.2.
I can imagine two solutions, but I don’t know how to do it in nix:
-
Tell both
transformers
anddiffusers
to use my own version ofhuggingface-hub
instead of the version frompython312Packages
. This might be doable by an overlay. Can someone help? -
Tell the build procedure of LTX-Video to prefer the version 0.25.2 of
huggingface-hub
that is provided explicitly by me and to ignore any other version of it that might come through from the other required packges.
Any help would be much appreciated.