How to install Anaconda (Python)

When I installed Anaconda (actually, I installed Miniconda, but it should be just the same), it failed to work with sudo. So, here is my tutorial for how to install Anaconda successfully. (For those who may not know, Anaconda is an open-source Python distribution designed for large-scale data analysis. It comes with a Python package management system and many modules pre-downloaded.)

1: Download the .sh file from here (if on a Raspberry Pi, from here.) I recommend Miniconda because the full Anaconda package has about a thousand packages, mostly for data science, included, and it is several gigabytes in size. With Miniconda, you can download it much faster and still install whatever you need easily

2: From the Start Menu, go to System Tools>MATE Terminal. This will open up a Terminal session.

3: Type sudo -i and type your password when prompted. Nothing will appear as you type: this is normal and is a security feature. You will be shown a command prompt that looks like normal, except there will be a # instead of a $ at the end.

4: Type cd ~/Downloads. If you didn't download the file to Downloads, change it to wherever you downloaded the file to. Type bash miniconda-file.sh, replacing miniconda-file with the name of the file you downloaded. It should look something like Miniconda3-latest-Linux-x86_64.sh This will start the installer.

5: Hit enter to continue with the installation. You will be presented with a license and terms of use. The quickest way to go through this is to hit space; this will take you through a few lines at at time. You will be asked if you accept the license terms. Type yes and hit enter.

6: The default location should be good, so just hit enter. There will be several lines of installing: package that will appear, then you will be asked if you wish for the installer to prepend the Miniconda installation to your PATH. Type yes and hit enter.

7: You will be shown a message that the installation is finished and you will need to open a new Terminal session to use it. Type exit, hit enter, and close the terminal window. Open a new terminal session from Menu>System Tools> MATE Terminal. To test the installation, type conda list
If you get a list of packages, the installation was successful. Now for the slightly tricky part

8: If you want to install any packages using the conda command, you will need to use sudo, i.e. sudo conda install jupyter, but you may get a message "sudo: conda: command not found". Here's what you need to do:

9: Open a fresh terminal and type sudo -i typing your password when prompted.
This is the root shell, where you can do system stuff without having to type sudo every time.
Type conda list to confirm that it works. Then, type conda install jupyter
This will install Jupyter Notebooks, a useful took for writing Python code. Type y when asked if you wish to proceed and hit enter. It will take a little while to install. When it is done, you can exit the terminal.

10: To test that the installation of Jupyter Notebooks was successful, open the terminal again and type jupyter notebook
This will start the Jupyter Notebook, and a Firefox window will open with some stuff in it. You can close it. In the terminal, hit Ctrl+C twice to stop the notebook process.

You will not need to enter the root terminal with sudo -i every time you need to run Jupyter, but you will need to when you want to install a package.

Hopefully this is helpful to someone.
Joel

2 Likes

Thank you. This was helpful. For raspberry pi, the miniconda from your link may not work. This is better bash file for raspberry pi: http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh

Refer to: https://stackoverflow.com/questions/36899863/anaconda-python-cannot-execute-native-linux-32-binary

Thanks for your suggestions. I would like to add here too.

Anaconda is a package manager used in scientific computing and data science. It’s designed to provide scientific libraries and dependencies in the Python programming language. Anaconda is commonly used for machine learning and artificial intelligence applications.

Steps For Installing Anaconda
Step 1: Update Local Package Manager
Step 2: Download the Latest Version of Anaconda
Step 3: Verify the Download Checksum
Step 4: Run Anaconda Installation Script
(Optional) Step 5: Install VSCode Editor
Step 6: Activate and Test Installation

How to Update Anaconda on Ubuntu

To update Anaconda on Ubuntu, start by updating the conda utility:

conda update conda

Next, run the Anaconda package update command:

conda update anaconda