This page presents the installation of Keras for Linux. The following has been done on a fresh Ubuntu install on the following hardware / software versions:
Since Python 3 is natively installed with Ubuntu 16.04, no need to install or update Python. However, pip is required for installing TensorFlow and Keras. First, update Ubtuntu to get the lastest kernel and packages versions, then install pip.
# Update Ubuntu and reboot sudo apt upgrade sudo apt update # Reboot # Install pip sudo apt install python3-pip sudo pip3 install --upgrade pip
Even if it is not mandatory, it is highly recommended to isolate developments from other Python programs. This is the job of virtual environmennts
# Install virtual environment sudo pip3 install virtualenv
Create a working directory for your virtual environment wherever you want:
# Working directory mkdir ~/keras cd ~/keras
Create the virtual environment:
# Create virtual environment virtualenv venv
Activate the virtualenv environment by issuing the following command:
# Activate virtual environment source ~/keras/venv/bin/activate
source command should change your prompt to:
(venv)$. You can
exit the virtual environment with the
While the virtual environment is activated, install TensorFlow, then Keras:
# Install TensorFlow pip install --upgrade tensorflow # Install Keras pip install --upgrade keras
Check your installation:
# Check the Keras backend python -c "from keras import backend"
The preceding command should prompt:
Using TensorFlow backend.
# Install Tkinter sudo apt-get install python3-tk # Install Matplotlib pip install --upgrade matplotlib
snap find "visual studio code" sudo snap install vscode --classic sudo apt install pylint