However, trying to run tensorflow seems to fail. I’ve been trying various shell.nix files (Tensorflow - NixOS Wiki) which seem to patch various python wheel files or alternately download and compile using Bezel, but which then claim there is no GPU present.
Am I missing something? It appears many people have had success, but maybe things (nvidia drivers?) have moved on and are no longer repeatable?
I wrote that wiki link and regularly use both tensorflow 1 and 2 (wheel and nixpkgs). I can help debug your configuration. That nix-shell should have worked. I’m assuming you pip installed tensorflow within that shell? I’m on IRC or the discord if you want to debug more interactively.
One thought, if you’re on 20.03 LD_LIBRARY_PATH no longer contains the nvidia libraries by default (under /run/opengl-driver/lib:/run/opengl-driver-32/lib). You can add this line to your config to change that, or use nixGL in your .envrc
hardware.opengl = {
enable = true;
driSupport32Bit = true;
extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
setLdLibraryPath = true; <- This is the line you should add to restore old functionality
};
I almost guarantee that’s it. This nix-shell also automatically handles appending LD_LIBRARY_PATH for you if you want to keep LD_LIBRARY_PATH pure, and uses a shellHook call to nixGL combined with a .envrc to source the shellHook should you be using lorri (which you should if you’re using cuda, or you can accidentally GC the library)
No problem, I forgot to link above, but the above git repo shows how you can automatically set everything up and uses poetry2nix which I would recommend checking out (it handles tensorflow, but currently has to build from source)