{"id":22019361,"url":"https://github.com/kohulan/tensorflow-2.0-installation-with-cuda-support","last_synced_at":"2025-05-07T03:43:29.100Z","repository":{"id":39863437,"uuid":"198430732","full_name":"Kohulan/Tensorflow-2.0-installation-with-CUDA-support","owner":"Kohulan","description":"A detailed step by step guide to install Tensorflow-2.0-gpu with CUDA Drivers on Ubuntu Server/ Desktop LTS","archived":false,"fork":false,"pushed_at":"2022-05-24T08:14:42.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T03:43:25.944Z","etag":null,"topics":["cuda","gpu","nvidia","ubuntu"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kohulan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-23T12:56:41.000Z","updated_at":"2022-08-12T06:29:29.000Z","dependencies_parsed_at":"2022-08-27T17:20:12.595Z","dependency_job_id":null,"html_url":"https://github.com/Kohulan/Tensorflow-2.0-installation-with-CUDA-support","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FTensorflow-2.0-installation-with-CUDA-support","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FTensorflow-2.0-installation-with-CUDA-support/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FTensorflow-2.0-installation-with-CUDA-support/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FTensorflow-2.0-installation-with-CUDA-support/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kohulan","download_url":"https://codeload.github.com/Kohulan/Tensorflow-2.0-installation-with-CUDA-support/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810272,"owners_count":21807759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","gpu","nvidia","ubuntu"],"created_at":"2024-11-30T05:16:46.062Z","updated_at":"2025-05-07T03:43:29.084Z","avatar_url":"https://github.com/Kohulan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# CUDA-11-with-Tensoflow2.0-Installation-Guide\n\nInstalling Nvidia Drivers, Installing CUDA drivers with cuDNN on a Ubuntu machine is not straightforward. Where many tutorials give a detail step-by-step guide to install Tensorflow-1.0, There is no proper tutorial which explains the steps a beginner should take when installing Tensorflow-2.0. This is a more elaborative guide on installing All the necessary drivers and kick off your first machine learning algorithm.\n\n## First, remove all previous CUDA and NVIDIA installation.\n```shell\nsudo apt-get --purge remove \"*cublas*\" \"cuda*\" \"nsight*\" \"*nvidia*\"\nsudo nano /etc/apt/sources.list #comment nvidia dev \nsudo apt --fix-broken install\n```\n## Second, add NVIDIA package repositories: \n```shell\nwget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin \nsudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 \nsudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub\n```\nYou might need to check the https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ link to check for the latest keys pub file and modify the previous line.\n\n```shell\nsudo add-apt-repository \"deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /\" \nsudo apt-get update \nwget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb \nsudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb \nsudo apt-get update \nwget --no-check-certificate https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libnvinfer7_7.1.3-1+cuda11.0_amd64.deb \nsudo apt install ./libnvinfer7_7.1.3-1+cuda11.0_amd64.deb \nsudo apt-get update \n```\n\n## Third, install development and runtime libraries (~4GB)\n```shell\nsudo apt-get install --no-install-recommends cuda-11-3 libcudnn8=8.2.1.32-1+cuda11.3 libcudnn8-dev=8.2.1.32-1+cuda11.3 #cuda-runtime-11-3 cuda-demo-suite-11-3 cuda-drivers-510 nvidia-driver-510 libnvidia-extra-510\nsudo apt-get update \n```\n## Finally, reboot the PC and check the installation\n```shell\nsudo reboot\nnvidia-smi\n+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 515.43.04    Driver Version: 515.43.04    CUDA Version: 11.7     |\n|-------------------------------+----------------------+----------------------+\n| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n|                               |                      |               MIG M. |\n|===============================+======================+======================|\n|   0  NVIDIA GeForce ...  On   | 00000000:3B:00.0 Off |                  N/A |\n| 23%   27C    P8    16W / 250W |      1MiB / 11264MiB |      0%      Default |\n|                               |                      |                  N/A |\n+-------------------------------+----------------------+----------------------+\n```\n## Installing pip3 and Tensorflow-2.x-GPU\n\n  - The support for python v2.7 ended officially in 2020, So it's better if we can stick with python version 3.6\n\n### Step 1 (Installing pip3):\n  - Use the following commend to install pip3 in your PC,\n  ```shell\n  $ sudo apt-get install python3-pip\n  $ sudo pip3 --upgrade pip\n  ```\n  \n### Step 2 (Installing Tensorflow):\n  - Now let's install Tensorflow 2.x\n  ```shell\n  $ pip3 install tensorflow-gpu==2.x.0\n  ```\n### Step 3 (Verifying the installation):\n  - Run the following inside python3 terminal to verify the installation\n  ```shell\n  $ python3\n  ```\n  ```python\n  \u003e\u003e\u003e import tensorflow as tf\n  \u003e\u003e\u003e hello = tf.constant('hello tensorflow')\n  \u003e\u003e\u003e x = [[2.]]\n  \u003e\u003e\u003e print('hello, {}'.format(tf.matmul(x, x)))\n  2019-00-00 16:04:38.589080: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library   libcublas.so.10.0\n  hello, [[4.]]\n  \u003e\u003e\u003e exit()\n  ```\n### That's it you have successfully Tensorflow-2.x-GPU with CUDA 11.0.\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkohulan%2Ftensorflow-2.0-installation-with-cuda-support","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkohulan%2Ftensorflow-2.0-installation-with-cuda-support","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkohulan%2Ftensorflow-2.0-installation-with-cuda-support/lists"}