Cuda is not available on ipyhon but available on python console

I am trying to use pytorch with gpu, but it is so weird that torch can detect gpu(cuda) on ipython console, but not on python console.

It seems both of them are using the same python interpreter, but the environment is different.

I’m not very familiar with ipython/conda but doesn’t it say right there that they are different environments? The first python executable is just in miniconda3 but the second one is in its own /env.

Which CUDA version are you using?

CUDA 10.2.
I was figure out why this situation happened. There are two version pytorch installed on my PC, the pytorch pytorch=1.6.0=py3.8_cuda102_cudnn7_0 and pytorch=1.6.0=cpu_py38h538a6d7_0 in different conda environment. But I stiil don’t know why this happend when I use different console in the same conda environment. Is there any differernt when using IPython with Python ?

One of your environment is running a CPU only version of PyTorch. It seems that Ipython is using it.