nixified-ai / flake

A Nix flake for many AI projects
GNU Affero General Public License v3.0
675 stars 73 forks source link

Torch is borken in nixpkgs ? #58

Closed lanathlor closed 1 year ago

lanathlor commented 1 year ago

Hi.

While running nix run .#invokeai-nvidia I end up getting a crash.

error: builder for '/nix/store/17w2k9yq7jr1jhfy63wb6l053w7si37p-7ae4d7c0e2dec358b4fe81538efe9da5eb580ec9.patch.drv' failed with exit code 1;
       last 7 log lines:
       >
       > trying https://github.com/pytorch/pytorch/pull/108847/commits/7ae4d7c0e2dec358b4fe81538efe9da5eb580ec9.patch
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (22) The requested URL returned error: 406
       > error: cannot download 7ae4d7c0e2dec358b4fe81538efe9da5eb580ec9.patch from any mirror
       For full logs, run 'nix log /nix/store/17w2k9yq7jr1jhfy63wb6l053w7si37p-7ae4d7c0e2dec358b4fe81538efe9da5eb580ec9.patch.drv'.
error (ignored): error: cannot unlink '/tmp/nix-build-linux-headers-5.19.16.drv-3/linux-5.19.16/usr/include/linux': Directory not empty
error: 1 dependencies of derivation '/nix/store/zj1h1xwdp870d27gqsq0zixhq9231k1d-python3.11-torch-2.0.1.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-perl5.38.0-Module-Build-0.4231.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/4v7gbq225xfwlxnrflra4ds7fifs9cn2-python3.11-accelerate-0.23.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-openssl-3.0.11.drv-1/openssl-3.0.11/crypto': Directory not empty
error: 1 dependencies of derivation '/nix/store/n55js9hsfgx8zd0r3wllgpsr5kpaznqk-python3.11-safetensors-0.3.3.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xdq819mifas9p85aasqm2aaj5r1fsr6v-python3.11-timm-0.9.8.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8rk0r41hwnbf5x2v2z3grzihf8kw5vvw-python3.11-torchvision-0.15.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5jmnh9mjk1y5sm8bqp0izssa2v4579qn-python3.11-InvokeAI-3.3.0post3.drv' failed to build

I traced down this https://github.com/pytorch/pytorch/pull/108847 and this https://github.com/NixOS/nixpkgs/pull/249259. I dont know if there is anything to be done while this is fixed upstream. I tried using a previous build of torch but failed.

MatthewCroughan commented 1 year ago

Looks like that patch is not available anymore, mistake on part of nixpkgs, they should have downloaded the patch and put it in the nixpkgs repository.

lanathlor commented 1 year ago

Yes, thats my guess too. I dont know if something could be done here. I tried playing around with the idea to fetch the package of a previous commit but havent succeeded :/

pbsds commented 1 year ago

Is this it? https://github.com/pytorch/pytorch/commit/7ae4d7c0e2dec358b4fe81538efe9da5eb580ec9.patch

lanathlor commented 1 year ago

I think so

max-privatevoid commented 1 year ago

The patch is not accessible under the original URL anymore because PyTorch's merge bot force-pushed the branch. Seems like nixpkgs isn't aware of the issue yet. We should replace the URL upstream. We can also run overrideAttrs on the patch in an overlay as an intermediate fix.

ConnorBaker commented 1 year ago

Should be fixed by https://github.com/NixOS/nixpkgs/pull/264379.