virchau13 / automatic1111-webui-nix

AUTOMATIC1111/stable-diffusion-webui for CUDA and ROCm on NixOS
MIT License
142 stars 19 forks source link

libc10_hip.so: cannot open shared object file #1

Closed 128f closed 1 year ago

128f commented 1 year ago
/path/to/repos/stable-diffusion-webui/venv/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libc10_hip.so: cannot open shared object file: No such file or directory

I've tried multiple flakes including the ones from the original thread. hmm

this occurs when running the webui.sh

128f commented 1 year ago

Worked with:

let
  pkgs = import <nixpkgs> {};
  unstable = import <nixos-unstable> {};
in with pkgs;
mkShell rec {
    name = "stable-diffusion-webui";
    buildInputs = [
        git # The program instantly crashes if git is not present, even if everything is already downloaded
        python310
        #pkgs.python310Packages.pytorch-bin
        unstable.python310Packages.torchWithCuda
        unstable.python310Packages.torchvision
        unstable.python310Packages.pip
        stdenv.cc.cc.lib
        stdenv.cc
        ncurses5
        binutils
        gitRepo gnupg autoconf curl
        procps gnumake util-linux m4 gperf unzip
        cudatoolkit linuxPackages.nvidia_x11
        libGLU libGL
        xorg.libXi xorg.libXmu freeglut
        xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr zlib
        glib
    ];
    shellHook = ''
        export LD_LIBRARY_PATH="${lib.makeLibraryPath buildInputs}"
        export CUDA_PATH=${pkgs.cudatoolkit}
        export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
        export EXTRA_CCFLAGS="-I/usr/include"
    '';
}

which I activated with NIXPKGS_ALLOW_UNFREE=1 nix-shell file.nix. In order to use xformers I had to do:

pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers

from inside the venv. Which took a long long time.

Probably that could be added to shellHook or something? There's probably a quicker way to get a working xformers.

virchau13 commented 1 year ago

This is fairly easy and quick now due to ./webui.sh --xformers. I ran into a similar issue also, but it turns out that this was just because my venv had an outdated version of PyTorch. I've added troubleshooting advice to the README.