Maybe it’s completely unrelated to your problem, but this week Ubuntu updated the NVidia drivers on my machine (more or less automatically using the software updater) and PyTorch couldn’t use cuda anymore. After a restart, the error vanished.