Learn to install Keras & TensorFlow on Ubuntu Linux to build your own Artificial Intelligence (AI) and Machine Learning cloud. Keras is a neural network deep learning API written in Python, running on top of the machine learning platform TensorFlow. TensorFlow provides a collection of workflows to develop and train machine learning models on the cloud, and its GPU support makes VPS cloud servers such as GPU Compute ideal for your machine learning projects.
Summary
- Create an AMD Ryzen NVMe VPS with Ubuntu 16.04 and 18.04
- Connect to your VPS Cloud Server via SSH
- Install Keras & TensorFlow
- Install NVIDIA driver, CUDA and cuDNN (for GPU Compute only)
Installing Keras & TensorFlow
- As good practice, ensure all packages are up-to-date:
sudo apt-get update -y
- Execute the following commands to install and update Python3 and Pip:
sudo apt install python3 python3.pip sudo pip3 install ––upgrade pip
- Update Setuptools using the following command:
pip3 install ––upgrade setuptools
- Install TensorFlow and confirm the package information using these commands:
pip3 install tensorflow pip list | grep tensorflow
- Install Keras using the following command:
pip3 install keras
- You may wish to run the following command to verify the installation with the package information:
pip3 show keras
Installing NVIDIA driver, CUDA and cuDNN
In order to ensure that you can utilise GPU for Tensorflow within our GPU Compute, you will need to ensure that you have the latest and correct NVIDIA driver, CUDA & cuDNN installed within your VPS.
Install NVIDIA driver for Ubuntu
First, download the latest NVIDIA driver from here using the wget command, and then run the following command to install it:
sudo sh NVIDIA-Linux-x86_64-XXX.YY.run
Install CUDA
Then, download the latest CUDA from here using the wget command, and then run the following command to install it. Remember to take note on the instructions given at the end of installation to add the additional lines to your shell script:
sudo sh cuda_XXX_linux.run
Install cuDNN
Finally, refer to the official guideline here to complete cuDNN installation.
Conclusions
This tutorial shows you how to install Keras & TensorFlow on Ubuntu, as well as installing the right NVIDIA driver, CUDA & cuDNN for your cloud server.
Important Information
You may wish to be mindful of future updates done to Ubuntu (sudo apt-get update) may break your NVIDI driver, CUDA & cuDNN installation. When this happens, simply roll back with your Ubuntu upgrade and switch back to the kernel version that worked well.