PyTorch Docker does not detect my GPU

Hello PyTorchers

I am using the latest PyTorch docker container inside PyCharm Pro 2021.1.
And I transformed the quickstart tutorial notebook into a python script, and it trains the Fashion MNIST stuff like a charm in that environment :slight_smile:
Unfortunately the function torch.cuda.is_available() tells that there is no GPU support and runs on slow CPU instead.
I am new to docker, so please bare with me if my questions seems stupid or my trials are doomed to fail.

I googled for that and found out that I should use “–gpus all” in my Debug Configuration \ Docker container settings.
But when I do that the containers fails to start with the error:
“Error running ‘quickstart_tutorial’: Cannot run the remote Python interpreter: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request: unknown”

I also saw some solutions telling me to change /etc/docker/daemon.json.
Well, I have no clue where to do this change (I run Windows 10, so I do not have /etc/… on my system!?) and noone in these solutions ever bothers to explain.

I also tried adding “–runtime nvidia” to the docker settings, but that fails with:
“Error running ‘quickstart_tutorial’: Cannot run the remote Python interpreter: Unknown runtime specified nvidia”

Finally I tried the pytorch/pytorch:1.6.0-cuda10.1-cudnn7-runtime docker container instead of pytorch:pytorch:latest.
It fits to my CUDA 10.1 and CUDNN 7.6 install, which I derived both from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include\cudnn.h
But this did not change anything, I still see the same errors as above.

I would like to avoid upgrading my CUDA version, since I had a really hard time to get it running the last time.
And I thought running docker containers is exactly the solution to avoid such environment changes & breaks!?

Can anyone help me to get this pytorch docker quickstart tutorial run on my NVIDIA GTX 1080Ti?


I don’t think nvidia docker containers are directly supported on Windows but via WSL2.

Meaning that I cannot run (pytorch) docker with GPU support in a Windows 10 environment?
Or do I “just” need another docker container?

I don’t think you can run an nvidia docker container on Windows directly, but would need to use WSL2.

Ah now I get it. So I need to run a Linux inside my Windows 10.
I worked with VirtualBox from Oracle some time ago. But as far as google and some forums tell me I cannot use VirtualBox for GPU passthrough, only WSL. I will look into this.

To be honest I find it a little sad that an environment for python, that claims to be plattform independent and even exists to abstract from the plattform, misses such an important feature :frowning:

Thx for support :slight_smile: