Jupyter-lab can't see GPU when running in Anacanda

I think this is an Anacanda.Navigator question not a programming question since the same code does not run the same in all environments.

Problem is running in jupyter-lab from Navigator Environments the GPU is not detected by CUDA. The program is simple:

import torch

print(torch.cuda.is_available()) ←—- shows true
if (torch.cuda.is_available()):
print(“\r\n********* YAY: GPU IS AVAILABLE *************”)
print (f"Number of GPUS is -should be 1-: {torch.cuda.device_count()}" )
print(f"Current GPU name is: {torch.cuda.get_device_name(0)}\r\n")
else:
print(“\n\rGPU is NOT NOT NOT Available\r\n”) < show NOT NOT NOT Available

All other environments runs this fine:

  1. GPU is detected if I just set the environment in a Command Windows then run jupyter-lab
  2. GPU is detected in Spyder under Command Window
  3. GPU is detected running Spyder from anaconda.Navigator

Since cuda detects the GPU in spyder when run from Anaconda Navigator I believe that says all the modules are loaded and correct. And if I don’t use anaconda, just do a conda -env and then run jupyter-lab it works, also says the modules are loaded sufficiently.

I want to use Navigator since it is the easiest for me. Obviously, there is something I was suppose to set and didn’t. What is it?

Thanks in advance.

This may have been a dumb question because there has been no response. I did discover an additional piece of information that may help.

In the anaconda environment:

Printing the version of Torch in Spyder (torch._version_) is 2.9.1+cu130 (GPU is detected)
Printing the version of Torch in jupyter (torch.__version>>) is 2.7

Brings up two questions:

  1. Obviously, the problem is jupyter is not using the desired version of torch.
  2. How do I get jupyter to use this version of torch? Why would it be different in spyder and jupyter?