How to Set Up Anaconda3 for Machine Learning on Ubuntu 20.04?

I am sharing about to Set Up Anaconda3 for Machine Learning on Ubuntu 20.04. As machine learning and deep learning demand the flawless platform to execute it properly. Keras, tensorflow, panads , numpy, scikit-learn, seaborn and matplotlib are a few libraries which are very important in machine learning.

Pre-requisites for setting up machine learning on Ubuntu 20.04

  • First of all Ubuntu 20.04/ 18.* or 21.10
  • Anaconda3 must be installed and updated prior to start set up. Detailed installation process could be read/watch as video included here: click here

Step 1: Open terminal

Just open terminal of Ubuntu and must run the followings:

$ sudo apt update && sudo apt upgrade -y

Then activate conda environment, I would like to activate the default environment i.e. base

$ conda activate base

Step 2: Install keras-gpu or keras only

If you have any graphic card (for example NVIDIA) installed in you pc then you should go for keras-gpu

$ conda install -c anaconda keras-gpu

Otherwise just run the following on the pc’s have not any graphic card. Whilst graphic card or gpu is recommended for machine learning.

$ conda install -c anaconda keras 

After running one of the above commands of your choice, you will find that Anaconda Installer will ask you permissions several times to press ENTER or yes or [y/n], I would like you to press ENTER or yes or y to continue the installation with its default settings. You should do these for every individual installation of dependency i.e. pandas, seaborn etc

It takes a few minutes depending upon the strength of your pc and internet connection.

Step 3: Install pandas and numpy

Run the following commands one by one to install pandas and numpy libraries which are very important here to have in this whole set up.

$ conda install -c anaconda pandas
$ conda install -c anaconda numpy

Step 4: Install dependencies for connection to Excel and .csv

This step is very important to play with data having ability to import/export and preparation it for machine learning models or for neural networks.

Run the following commands one by one:

$ conda install -c anaconda xlrd
$ conda install -c anaconda xlwt

Step 5: Install seaborn

As seaborn library plays very important role in data visualisation based on matplotlib. It provides a high level informative statistical graphics and attractive drawings.

Run the following command:

$ conda install -c anaconda seaborn

Step 6: Install scikit-learn

I could say scikit-learn library the back bone of machine learning as dealing with selection of efficient tools and statistical modelling that include classification, regression, clustering and reduction using Python.

Run the following:

$ conda install -c anaconda scikit-learn

Step 7: Install Python Image Library (PIL)

Pillow is very famous Python Image Library which supports in loading, manipulating and saving images for machine learning.

Run the following:

$ conda install pillow

Step 7: Verify installation of all installed packages

While going to finish our job, we must verify all the above libraries by importing them into Python directly inside the terminal by initiating Python3 into terminal or using jupyter notebook.

>>>import keras
>>>import pandas
>>>import matplotlib
>>>import numpy
>>>import tensorflow


No worries about tensorflow to install it individually because when we install keras, it automatically been installed.

Video Tutorial for all the installation process mentioned above


We have set up a fully loaded machine learning platform. Enjoy your machine learning and deep learning projects.


Leave a Reply