Pytorch + Cuda = Driver not Found

Pytorch cannot find the Cuda driver. I see Nvidia-SMI however which usually means everything should be OK.

Any thoughts?

Here’s a minimal PyTorch configuration which worked:

{ pkgs, config, ... }:
{
  environment.systemPackages = with pkgs; [
                             (pkgs.python3.withPackages (ps: with ps; [
                                                        pytorch-bin
                                                        ]))
                             ];

  nixpkgs.config = {
                 allowUnfree = true;
                 cudaSupport = true;
                 };

  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.opengl.enable = true;

}

The OpenGL option was (confusingly) a must!

1 Like

Are you running on NixOS or non-NixOS Linux? The directions differ depending on the OS.

You can find more info in the wiki pages here and here.

NixOS. It works great now, just a little confusing

1 Like

We’re always looking for ways to improve the docs! The wiki is open for edits, and if you have any other ideas on how to improve the onboarding experience do let us know!

1 Like

Fundamentally in this case, the OpenGL requirement for CUDA was confusing…

As for docs… I wonder… if a searchable list of minimal complete configurations which achieve certain taks would be good.

Nixos, like all functional programming, is extremely copy and pastable…