Hello, I am using flake.nix to set up my project environment. But I failed to build the python313Packages.torch-bin.
Here is the output.
error: Cannot build '/nix/store/d79qgcmzih32xnh1y5lvcqfw2p5wzkj6-python3.13-torch-2.10.0.drv'.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/ph94rl5rb5cb563g9ffj5x5vwz542qq0-python3.13-torch-2.10.0
/nix/store/yk1x8jp8kdfa6i6a9jddyzxrzhkrjqg8-python3.13-torch-2.10.0-dist
Last 25 log lines:
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> no configure script, doing nothing
> Running phase: buildPhase
> no Makefile or custom buildPhase, doing nothing
> Running phase: pythonRuntimeDepsCheckHook
> Executing pythonRuntimeDepsCheck
> Checking runtime dependencies for torch-2.10.0-cp313-cp313-linux_x86_64.whl
> - fsspec not installed
> - cuda-bindings==12.9.4 not satisfied by version 12.8.0
> - nvidia-cuda-nvrtc-cu12 not installed
> - nvidia-cuda-runtime-cu12 not installed
> - nvidia-cuda-cupti-cu12 not installed
> - nvidia-cudnn-cu12 not installed
> - nvidia-cublas-cu12 not installed
> - nvidia-cufft-cu12 not installed
> - nvidia-curand-cu12 not installed
> - nvidia-cusolver-cu12 not installed
> - nvidia-cusparse-cu12 not installed
> - nvidia-cusparselt-cu12 not installed
> - nvidia-nccl-cu12 not installed
> - nvidia-nvshmem-cu12 not installed
> - nvidia-nvtx-cu12 not installed
> - nvidia-nvjitlink-cu12 not installed
> - nvidia-cufile-cu12 not installed
For full logs, run:
nix log /nix/store/d79qgcmzih32xnh1y5lvcqfw2p5wzkj6-python3.13-torch-2.10.0.drv
I am using nixos-unstable channel. And not only my flake.nix can’t build but also the nix-shell -p python313Packages.torch-bin can’t build. Is this my fault?
No. The package requires exactly version 12.9.4 of the cuda-bindings, but the version in nixpkgs unstable is 12.8.0, so the dependency check fails.
You can do this, you can also be more precise and only disable the check for a specific dependency instead of all of them.
That said, while this is commonly done, it is not guaranteed to work as the pinning or restriction of a package version might be needed, e.g. if the API has changed making the code incompatible.
An alternative way, would be to bump the version of the cuda-bindings yourself, and use that to override the version of cuda-bindings used in torch-bin.
if you want to you can try to use my WIP project that deals with torch/cuda
edit: if you do this please explicitly pin to the latest commit of the feature-py-version-resolve branch, because as long as I am modifying the infrastructure, it will cause you a complete rebuild of all python packages, whenever I push a change and you run nix flake update which is unnecessary unless you require a newer package I add support for that is broken when added via extraDeps from nixpkgs
edit: also be careful with flash-attn there is no wheel yet for torch 2.10, so you will have to build it from source and it OOMs my 96Gb ram and swap machine in 5 seconds if i dont restrict max jobs and cores
I found that the package python313Packages.torch can be built and its torch.cuda.is_available() return True. So I just need to use python313Packages.torch instead of python313Packages.torch-bin. Thanks.