Published in


Quantrium Guides

Installing TensorFlow 2 with NVIDIA GPU on Google Cloud Instance

$ sudo apt-get update$ sudo apt-get upgrade
$ wget http://us.download.nvidia.com/tesla/418.126.02/NVIDIA-Linux-x86_64-418.126.02.run $ sudo chmod +x NVIDIA-Linux-x86_64-418.126.02.run$ sudo ./NVIDIA-Linux-x86_64-418.126.02.run$ sudo reboot
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.243-1_amd64.deb$ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub$ sudo dpkg -i cuda-repo-ubuntu1804_10.1.243-1_amd64.deb$ sudo apt-get update$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb$ sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb$ sudo apt-get update$ sudo apt-get install --no-install-recommends nvidia-driver-430$ sudo reboot$ sudo apt-get update$ sudo apt-get upgrade
$ nvidia-smi
$ sudo apt-get install --no-install-recommends cuda-10-1 libcudnn7= libcudnn7-dev=$ sudo apt-get install -y --no-install-recommends libnvinfer6=6.0.1-1+cuda10.1 libnvinfer-dev=6.0.1-1+cuda10.1 libnvinfer-plugin6=6.0.1-1+cuda10.1
$ sudo apt autoremove
$ mkdir tfproject$ cd tfproject/$ sudo apt-get install python3-dev$ sudo apt-get install python3-venv$ python3 -m venv tfenv$ source tfenv/bin/activate
$ pip install --upgrade pip$ pip install -U setuptools$ pip install tensorflow
$ python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"



This is Quantrium’s official tech blog. A blog on how technology enables us to develop great software applications for our clients.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store