Information regarding GPU connection in anaconda

Hi there,
In recent 3 days my head got stuck in stochastic GPU connection to anaconda process, i tried everything which were posted on internet and youtube but i failed to connect my GPU on jupyter lab, i have nvidia geforce rtx 3060 but i am unable to connect this on my jupyter lab, please anyone can help me in this problem, i am creating face detection project and i need GPU for train my model.
I run this command tf.test.is_gpu_available(“GPU”) and this give false, can anyone please guide me how to connect my on conda environment.
Here is my discord id if 1:1 conversation is possible because it gives both of us much more over this problem. id: Discord

Thank you.
Best regards,
Shantanu

1 Like

what is the error you are getting @Shantanu7 ?

Did you download all the necessary package to run in the conda environment.

  1. check with these commands to verify gpu access.
    tf.test.is_built_with_cuda() (TensorFlow) or torch.cuda.is_available() (PyTorch) to verify that your GPU is accessible

  2. Also check if you have downloaded tensforflow-GPU or Pytorch

  3. To test gpu usage, command is

tf.config.list_physical_devices(‘GPU’) (TensorFlow) or torch.cuda.get_device_name(0) (PyTorch) to verify that your GPU is being used for computations.

Here is a stackflow link which should help you understand gpu connectivity to your jupyter notebook

Another link

Hope this helps!

Regards
DP

I knew that you would reply me. i doesn’t received any error.
i run the code to find is gpu available or not and the code say false.

the tensorflow 2.10.0 have all pacakages in their so, there’s no need to download tensorflow-gpu 2.6.0(the version of the packages is latest version in conda).
Gemini and tensorflow documents say there’s no need to download tensorflow-gpu.
first i downloaded cudatoolkit 11.2 and cudnn 8.1.0 and then tensorflow 2.10.0.

so when you run on GPU the commmand if you is being used, what does it give output?

it gives “False” in output it means there’s no GPU

then did you try to download tensorflow-gpu?

I am suspecting the version discrepancy between python/CUDA and tensorflow version.

When I had done, I had to download tensorflow gpu, even if I had tensorflow version 2.11

Also if you want you can send me screenshot in DM, of your jupyter notebook when you run those commands, so I can see try to see what could be issue

are you using conda or not

Please try this:

$ conda create -n tf217 python=3.12
$ conda activate tf217
$ conda install -c conda-forge tensorflow
# if you want to install jupyter
$ conda install jupyter

In the python interpreter:

>>> import tensorflow as tf
>>> tf.test.is_gpu_available()
# warnings removed for the sake of clarity
True

This guide recommends staying away from conda when it comes to tensorflow and rely on pip.

1 Like

in documents it’s say tensorflow 2.10.0 is last release that support gpu on native window and in anaconda its say you should use python 3.9 for gpu use

I don’t have access to a windows machine to help you out. The steps shared earlier were for a linux based environment. The installed version of tensorflow via conda is 2.17 (fixed the previous post to rename the environment name).

$ conda list "tensorflow|python|cuda"
# packages in environment at /home/username/anaconda3/envs/tf218:
#
# Name                    Version                   Build  Channel
brotli-python             1.0.9           py312h6a678d5_9  
cuda-crt-tools            12.4.131             h06a4308_0  
cuda-cudart               12.4.127             h99ab3db_0  
cuda-cudart_linux-64      12.4.127             hd681fbe_0  
cuda-cupti                12.4.127             h6a678d5_1  
cuda-nvcc-tools           12.4.131             h99ab3db_0  
cuda-nvrtc                12.4.127             h99ab3db_1  
cuda-nvtx                 12.4.127             h6a678d5_1  
cuda-nvvm-tools           12.4.131             h6a678d5_0  
cuda-version              12.4                 h3060b56_3    conda-forge
python                    3.12.9               h5148396_0  
python-flatbuffers        25.2.10            pyhbc23db3_0    conda-forge
tensorflow                2.17.0          cuda124py312ha1f05a4_200  
tensorflow-base           2.17.0          cuda124py312hfc7ff22_200  
tensorflow-estimator      2.17.0          cuda124py312he5efd2c_200  

Why are you using conda instead of a pip based approach?

As far as the docs are concerned, you can to file a ticket on tensorflow github repository to let them know that the docs might be out of date.

1 Like

hi, i had the same problem a few days ago …
this is how i solved it
First create a new environment in Anaconda based Python 3.10.16
then download these libraries

  • Python: 3.10.16
  • TensorFlow: 2.10.1
  • CUDA Toolkit: 11.2
  • cuDNN: 8.1.0
  • NumPy: 1.26.4
  • Pandas: 1.5.3
  • scikit-learn: 1.2.2
    and every thing run perfectly
    try it.
1 Like

Tensorflow 2.15+ uses keras 3. This will break tf 2.10 code.
Please help me understand why you want to stick with conda when the tensorflow team is requesting users to move to pip.

1 Like