Error response from daemon oci runtime create failed process_linux.go running prestart hook 0 caused nvidia-container-cli device error unknown device

sudo docker run --gpus 2 lambda-stack:20.04 python3 -c "import torch; print(torch.cuda.device_count())"
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: device error: 1: unknown device\\\\n\\\"\"": unknown.
ERRO[0000] error waiting for container: context canceled 

This error is often caused by running a docker image with more GPUs than the system has installed. Simply set the --gpus flag to N where N = the number of GPUs on your system.

sudo docker run --gpus 1 lambda-stack:20.04 python3 -c "import torch; print(torch.cuda.device_count())"
1