PyCharm can find CUDA but not the python

I installed the PyTorch using docker on the server. I use the PyCharm to remotely develop by connecting it to the python environment in docker container. I can use the CUDA. However, when I go to the container and start the Python environment, CUDA is not available. The command I use is torch.cuda.is_available(). Could someone give me some suggestions please?

Had a similar problem as well.
Make sure your cuda version and server’s driver are compatible:

On linux you can easily see that by typing nvidia-smi on terminal.

I had to downgrade my pytorch installation, since I couldn’t update the driver (not sudo).

Hi @shlomish3, thank you for your kind reply. But if it is the problem, why my PyCharm can access the CUDA? They are supposed to use the same environment.

Oh, you’re right.
It’s beyond my experience, then.
Thought I could help :slightly_frowning_face:

Super wired. I finally solve the problem: in the container I executed sudo python3 XXXX. When I type whoami, it told me root. I guess it must be the problem of docker.