Closed 128f closed 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.
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.
I've tried multiple flakes including the ones from the original thread. hmm
this occurs when running the
webui.sh