Installation Guide Python Ubuntu

How to Install Anaconda Python on Ubuntu 18.04 LTS

Anaconda Python is a Python distribution just like Ubuntu is a Linux distribution. Anaconda Python comes pre-installed with all the data science and machine learning tools. That’s why it’s great for people interested in those.   In this article, I will show you how to install Anaconda Python on Ubuntu 18.04 LTS. Let’s get started.

Downloading Anaconda Python:

Anaconda Python is not available in the official package repository of Ubuntu 18.04 LTS. But it can be downloaded from the official website of Anaconda Python.

To download Anaconda Python, first visit https://www.anaconda.com/download/#linux from any web browser of your choice and you should see the following page.

As you can see from the screenshot below, Anaconda Python is available for Python 3.6 and Python 2.7. In this article, I am going to show you how to download and install Anaconda Python for Python 3.6. The process is similar for Anaconda Python for Python 2.7.

Click on the Download button to download Anaconda Python for Python 3.6.

Now click on Save File and then click on OK.

Your download should start.

Installing Anaconda Python:

Now that Anaconda Python is downloaded, you can install it on your Ubuntu 18.04 LTS computer. I am going to show you how in this section.

First open up a Terminal and navigate to the ~/Downloads/ directory in your user’s HOME directory where you downloaded Anaconda Python with the following command:

$ cd ~/Downloads

If you list the contents of the ~/Downloads/ directory, you should see the Anaconda Python installer as you can see in the marked section of the screenshot below.

$ ls -lh

NOTE: By default, Anaconda Python will be installed on the ~/anaconda3 or ~/anaconda2 directory in your user’s HOME directory depending on which Python version of Anaconda Python you are trying to install. If you don’t have any problem with that, you can run the Anaconda Python installer without sudo or super user privileges. But if you want to install it somewhere else such as /usr/local/anaconda3 or /usr/local/anaconda2, or /opt/anaconda3 or /opt/anaconda2, then you must run the Anaconda Python installer with sudo or super user privileges and configure the PATH of your computer manually.

Now to install Anaconda Python, run the following command:

$ bash Anaconda3*.sh

Now press <Enter>.

Now press the <Space Bar> several times to go to the end of the License Agreement.

Once you see the following prompt, type in yes and then press <Enter> to continue.

Now you should see the following prompt. Here you put a directory path where you want Anaconda Python to be installed. By default, it is the ~/anaconda3 or ~/anaconda2 directory in your user’s HOME directory. But you can change that. I am going with the default. Just press <Enter>.

The installation should start.

Once the installation is complete, the installer should ask you whether you want to add Anaconda Python to the PATH of your Ubuntu 18.04 LTS. Type in yes and press <Enter>.

The installation and configuration is complete.

Recently Microsoft and Anaconda has joined up. So Anaconda Python installer asks whether you want to install the Microsoft’s free code editor Visual Studio Code. I will just say no as I don’t want to install Visual Studio Code.

Testing Anaconda Python:

Now that Anaconda Python is installed, you can open a new terminal and type in the following command to check whether Anaconda Python is added to the PATH of your Ubuntu 18.04 LTS operating system.

$ echo $PATH

As you can see from the marked section of the screenshot below, the Anaconda Python is on the PATH.

To check whether Anaconda Python is working, run the following command:

$ conda --version

As you can see, Anaconda Python is working correctly.

Installing New Packages of Anaconda Python:

Anaconda Python comes with a lot of packages pre-installed. But it you need some other packages, you can install it very easily with conda command.

You can find a list of all the packages available on Anaconda Python at https://docs.anaconda.com/anaconda/packages/pkg-docs

Click on your Anaconda Python version and operating system from the page. I installed Anaconda Python 64-bit for Python 3.6, so I clicked on the marked link 64-bit Linux, Py3.6.

You should see a table as shown in the screenshot below. The table contains 4 columns. The Name column contains the package name. The Version column holds the package version, Summary/License column holds a short description of the package and the In Installer column has marks that indicates whether the package is included in the Anaconda Python installer. If a tick mark is present, it means the package is already installed, so you don’t have to install it manually after installing Anaconda Python.

Now to install an Anaconda Python package, let’s say gitpython, run the following command:

$ conda install gitpython

Now press y and then press <Enter> to continue.

The gitpython package should be installed.

Removing an Anaconda Python Packages:

You can list all the installed Anaconda Python package with the following command:

$ conda list

To remove an Anaconda Python package, let’s say the gitpython package I just installed, run the following command:

$ conda remove gitpython

Press y and then press <Enter> to continue.

The gitpython package should be removed.

So that’s how you install Anaconda Python and manage Anaconda Python packages. Thanks for reading this article.

About the author

Shahriar Shovon

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.