Ultimate Guide: Install TensorFlow GPU on WSL2 Ubuntu 24.04 | CUDA, cuDNN, TensorRT & PyTorch

Learn how to install TensorFlow GPU on WSL2 Ubuntu 24.04 for Windows 11 in this comprehensive tutorial! This video covers the step-by-step process to install and configure the CUDA toolkit, cuDNN, and TensorRT. As a bonus, we'll also show you how to install PyTorch. Perfect for AI developers and data scientists looking to harness the power of NVIDIA GPUs on a Windows 11 system.
#################################################
I tried to put all the commands here but KZread didn't allow me to put the commands. Please check the github repository for all the commands:
github.com/mahbub-aumi/tensor...
#################################################
0:00 Introduction
0:30 Setting up WSL2 on Windows 11
2:00 Installing Ubuntu 24.04 on WSL2
3:45 Installing NVIDIA Drivers
5:15 Installing CUDA Toolkit
7:30 Setting up cuDNN
9:00 Installing TensorRT
11:00 Verifying CUDA and cuDNN Installation
12:30 Installing TensorFlow GPU
15:00 Testing TensorFlow GPU Installation
16:30 Bonus: Installing PyTorch
18:00 Testing PyTorch Installation
19:30 Conclusion

Пікірлер: 87

  • @NatanaelFerreiraCostadeCastro
    @NatanaelFerreiraCostadeCastroАй бұрын

    In more than three weeks of watching tutorials and looking for amazing solutions, you were the only one who could help me. Thank you very much.

  • @TechJotters24

    @TechJotters24

    29 күн бұрын

    You are welcome!! Really happy it works for you!!!

  • @AboElWes
    @AboElWesАй бұрын

    You Are a LEGEND man!!! After all that searching you are the one who's done it for me. Keep Going. CHEERS!!!

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Glad I could help

  • @shashankpericherla3399
    @shashankpericherla339927 күн бұрын

    Thank you so much bro , I wasted hours and days trying to figure whats wrong. you deserve more support and subscribers.

  • @TechJotters24

    @TechJotters24

    25 күн бұрын

    You are welcome. Really happy to help!!!

  • @narendralv6379
    @narendralv637920 күн бұрын

    Thank you!. This worked!

  • @bertjansen1811
    @bertjansen181117 күн бұрын

    Brilliant, Thank You! Been trying to do this for at least 6 month now and finally got it to work!!!😁

  • @inclinedadarsh
    @inclinedadarshАй бұрын

    I have been trying to do this for so long. Finally a video that showed me exactly how to do that and solved all my queries. Thank you so much!

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome.

  • @halilkaya4503
    @halilkaya4503Ай бұрын

    Thank you for preparing this guide, it was very helpful

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome

  • @WWinsWotV
    @WWinsWotVАй бұрын

    Thank you!! Guide worked perfectly.

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome!!!

  • @anandharsh
    @anandharshАй бұрын

    Thank you so much. Please keep uploading. Learned a lot from you. Respect.

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Thank you, I will

  • @iihyder
    @iihyderАй бұрын

    Thank you my brother! Very Useful video

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome!!!

  • @eymericchauchat
    @eymericchauchat27 күн бұрын

    You're the software wizard I needed, thank you very much

  • @TechJotters24

    @TechJotters24

    25 күн бұрын

    :D you are welcome

  • @surajkumar-vd6xl
    @surajkumar-vd6xlАй бұрын

    Thank you so much. Great tutorial! 👍👍👍👍👍👍👍

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome!!!

  • @ShahidulAbir
    @ShahidulAbirАй бұрын

    Great tutorial! Thank you so much.

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You're very welcome!

  • @bxyz
    @bxyz28 күн бұрын

    Thank you so much! The only tutorial that has worked so far end-to-end. Thanks again!

  • @TechJotters24

    @TechJotters24

    25 күн бұрын

    You are welcome.

  • @bxyz

    @bxyz

    2 күн бұрын

    @@TechJotters24 I tried to run the same instructions but after installing tensorflow @ [python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"] , I got: 2024-07-25 22:47:21.340568: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. 2024-07-25 22:47:21.616111: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2024-07-25 22:47:21.706543: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2024-07-25 22:47:21.727644: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2024-07-25 22:47:21.870530: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. Would you happen to know what happened?

  • @bxyz

    @bxyz

    2 күн бұрын

    I was able to fix it with this code: python3 -m pip uninstall tensorflow[and-cuda] python3 -m pip install "tensorflow[and-cuda]==2.16.1"

  • @nikitsbozenko3396
    @nikitsbozenko3396Ай бұрын

    Lol bro, I've been trying to find a solution to this problem for almost a week, I've read many gigabytes of information and visited every possible page on Nvidia's website, and somehow I can't solve this problem, you're my superman, thank you very much)❤❤❤

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome!!!

  • @yudhitanasa728
    @yudhitanasa728Ай бұрын

    Thank you so much. It works, really save the time. GOD BLESS YOU.

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome!!!

  • @neelg235
    @neelg235Ай бұрын

    Thank you SO MUCH! All other resources are sooo behind that I wasted way too much time trying to get TensorRT to show up.

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are most welcome

  • @ricardorise
    @ricardoriseАй бұрын

    You are de Guy. Thankyou very much

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Happy to help

  • @itsamitnitrkl5199
    @itsamitnitrkl5199Ай бұрын

    true legend to solve the problem

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Thank you!!

  • @nilutpaldas8336
    @nilutpaldas8336Ай бұрын

    **THIS VIDEO CAN HELP YOU TO INSTALL ANY VERSION OF CUDA, CUDNN, TENSORRT, AND TENSORFLOW IN YOUR WSL2** Thank you again for creating an updated video on this topic. feedback: kindly fix the chapter's timing it is not in sync.

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Hi, I’ll check it

  • @meaningbread15
    @meaningbread15Ай бұрын

    you're the best!

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Thank you !!!

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Thank you!!!

  • @kushaldudipala6285
    @kushaldudipala6285Ай бұрын

    thank you

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome!!!

  • @farhaanjamal33
    @farhaanjamal33Ай бұрын

    Thank you soooo much, It's clear and sharp to the point Can you help me how to use the tf environment for local windows folder in vs code

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    You are welcome. Sure I’ll help you.

  • @_fl3x_up_
    @_fl3x_up_Ай бұрын

    Thanks a lot man, this is the best video. I was trying to install for more than a day and couldn't. U r a saviour 🙏. One thing i want to ask is ur GitHub link u provided has some extra lines of code to execute at the end like sudo rm and few other lines that you don't talk about in the video, should I run them?

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Glad I could help

  • @abhijitmustafi
    @abhijitmustafiАй бұрын

    You are the new Buddha ...because you are the only one who shows the "right way" !!

  • @TechJotters24

    @TechJotters24

    29 күн бұрын

    Thank you!!!!

  • @HarrisonNguyen-z7m
    @HarrisonNguyen-z7m18 сағат бұрын

    If I install the latest version of tensorflow without tensorrt, would I later be able to use the downgraded versions of cuda and tensorflow for tensorrt? Also, the latest version of tensorflow uses cuda 12.3 while pytorch is 12.1 or 12.4, so can I have multiple cuda versions? I'm unfamiliar with these technologies because I'm just starting out.

  • @najrugky9851
    @najrugky985118 күн бұрын

    Does it work on other versions of Ubuntu, such as 20.04?

  • @SuzyQuimble
    @SuzyQuimbleАй бұрын

    Thank you so much for the video. I have a question--I have followed your guide exactly, but I get one extra warning message when I import tensorflow in jupyter: oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. Is this a cause for concern?

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Hi, it's generally not a cause for concern. You might see slightly different numerical results due to floating-point round-off errors from different computation orders. This is typical in many high-performance computing scenarios and usually not significant. Temporarily within Jupyter Notebook: import os os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' import tensorflow as tf Permanently in Your Environment: Add the below to .bashrc and after adding it, run source ~/.bashrc export TF_ENABLE_ONEDNN_OPTS=0

  • @furkanakin25
    @furkanakin25Ай бұрын

    Hello, very useful video. Thank you. I want to run Spyder, can you help me with this? Also I get a segmentation fault error when running the model, do you have any idea about this?

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Hi, sorry I don’t know about segmentation error. I’ll test spyder and let you know.

  • @henkiespenkie4414
    @henkiespenkie441419 күн бұрын

    on 17:11 i do get nvcc: command not found error but i could not solve it even with your tutorial :(

  • @joacosolbes9283
    @joacosolbes9283Ай бұрын

    Hello mister, I want to run some AI programs like stable diffusion and LLM locally, but my GPU is very low i have Nvidia Geforce GTX 1650 with only 4 gb of ram Can this nvidia drivers thing installed with WSL help me to run this kind of AI software? into a windows 11? or what is the real benefit to implement this? thanks a lot for your help

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Hi, I don’t think you need to do wsl. Try lm studio on windows. Smaller models will run perfectly and it’ll also suggest you which models are compatible with your system.

  • @charliesj0129
    @charliesj012929 күн бұрын

    After those installation ,How to use tensorflow in VScode ?

  • @TechJotters24

    @TechJotters24

    21 күн бұрын

    Hi @charliesj0129, please check this video - kzread.info/dash/bejne/dICe17SYlaTPdto.html

  • @HarnsHwong
    @HarnsHwongАй бұрын

    Can I use this method on the actual Ubuntu 24.04 instead of the WSL? Also, may I know how can I link the installed tensorflow to the jupyter notebook in VS code instead of the actual jupyter notebook?

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    Hi, I made one. kzread.info/dash/bejne/Y4imk8ufpbbOZtI.html

  • @HarnsHwong

    @HarnsHwong

    Ай бұрын

    @@TechJotters24 You're a legend man. Appreciate it alot!

  • @lowkeyleanin

    @lowkeyleanin

    Ай бұрын

    Thank you for this comment. Because of this, he made a new video. You are such a LEGEND

  • @ankursingh4617
    @ankursingh461724 күн бұрын

    its showing bad subsitutuion after i added tensor path....this is the error -bash: :${LD_ LIBRARY_PATH}: bad substitution

  • @TechJotters24

    @TechJotters24

    21 күн бұрын

    Hi, i believe the best solution is to check the directory first and remove all the bashrc/Path entries related to this and configure again.

  • @waqarkai
    @waqarkaiАй бұрын

    Great job! Does Tensorflow 2.16.1 support Cuda 12.1, or does it require Cuda 12.3?

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    The latest cuda toolkit you can use for tensorflow 2.16.1 is 12.3. But in that case you can’t use TensorRt. If you want tensorrt support, the latest cuda toolkit you can use it 12.1 because tensorflow support only tensorrt 8.6 and tensorrt 8.6 can only work with Cuda Toolkit 12.1. It’s a chain reaction :D

  • @waqarkai

    @waqarkai

    Ай бұрын

    @@TechJotters24 sir i follow the procedure with tf 2.16.1 with cude 12.1 unfortunately it isn’t identify gpu device. I switch to tf 2.15 with new env. It identify the device with many missing dependencies like cublas etc

  • @waqarkai

    @waqarkai

    29 күн бұрын

    @@TechJotters24 sir it works I don’t know the reason i just restart my system and make new conda env and just install tf and pytorch thank you soo much sir 😊

  • @TravelJotter24

    @TravelJotter24

    29 күн бұрын

    @@waqarkaigreat!!!

  • @hantornado7888
    @hantornado788822 күн бұрын

    hello, i followed every procedures of yours, but im installing cuda 11.8 and cudnn 8.6, coz based on tensorflow's website, they should be compatible with my rtx3060. however, i reached an issue in initializing cudnn. after running "./test_cudnn", this error pops out, when i use "ls" i can see the file, but coudnlt open, do you know how to solve this? ./test_cudnn: error while loading shared libraries: libcudnn.so.8: cannot open shared object file: No such file or directory thank you sir

  • @TechJotters24

    @TechJotters24

    21 күн бұрын

    I tried to figure it out, but I don't have this GPU available to test. I am really sorry.

  • @hantornado7888

    @hantornado7888

    21 күн бұрын

    @@TechJotters24 no problem, although that thing didnt work out, but eventually i got it done. However, as gpu was able to be used, i couldnt import any other python libraries like cv2 or mediapipe (pip installed, pip list also shows). So i guess i just decided to give up lol. But your videos are great, keep it up.

  • @matthewhu5017
    @matthewhu5017Ай бұрын

    Having a little trouble installing cudnn. I used the same cudnn tar and followed the commands exactly, but cudnn initialization keeps on failing :/ Do you have any idea what could be going wrong?

  • @TechJotters24

    @TechJotters24

    Ай бұрын

    What type of error you are getting?

  • @matthewhu5017

    @matthewhu5017

    Ай бұрын

    ​@@TechJotters24 Running `import torch` and `torch.cuda.is_available()` creates: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 2: out of memory (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.) Fixed it by removing one of three GPUs. Not sure why cudnn & the python commands above failed with 3 GPUs but runs with 2 GPUs. Could be a problem with Windows or WSL2 or a hardware limitation, since I've seen some Linux servers with 4+ GPUs Would love to hear if you have any thoughts as to why :)

  • @matthewhu5017

    @matthewhu5017

    Ай бұрын

    ​@@TechJotters24 Running `import torch` and `torch.cuda.is_available()` creates the following error: "UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 2: out of memory" Fixed the error by removing 1 of 3 GPUs. Curious why cudnn fails with 3 GPUs but works with 2 GPUs. Could be a hardware limitation or an issue with WSL2/Windows. I've noticed that my model auto-loader (exl2 running on Win11) can never utilize all 3 GPUs simultaneously for large models, while I've seen Linux servers handle 4+ GPUs before. Wondering if you have any idea what the root cause is! I'd love to figure it out 😃

  • @matthewhu5017

    @matthewhu5017

    28 күн бұрын

    ​@@TechJotters24 Was getting "Error 2: out of memory" using torch.cuda.is_available(). I removed the 3rd GPU and it worked with 2 GPUs. Probably a limitation on Windows/WSL, since I've noticed loading large models on Windows can't leverage all 3 of my GPUs using exl2 model loader.

  • @matthewhu5017

    @matthewhu5017

    28 күн бұрын

    @@TechJotters24 Was getting "Error 2: out of memory" using torch.cuda.is_available(). I removed the 3rd GPU and it worked with 2 GPUs. Probably a limitation on Windows/WSL, since I've noticed loading large models on Windows can't leverage all 3 of my GPUs using exl2 model loader.

  • @kuleenthejas8382
    @kuleenthejas838228 минут бұрын

    i pray that u r reserved a seat in heaven bro ,u saved me a ton :)

  • @arandomguy3526
    @arandomguy352615 күн бұрын

    Hi, is this error normal "E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered. E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered

  • @omartamer3274

    @omartamer3274

    13 күн бұрын

    same

Келесі