Learn the ways to install MiniConda3 on Ubuntu 20.04 LTS Focal Fossa to use Conda package manager to install Anaconda Packages.
The Anaconda distribution is a collection of software for scientific purposes. It includes a Python installation, an R installation, and the Conda package manager, which can be used to install Anaconda packages. Since the complete Anaconda distribution with all packages consumes a lot of storage space, there is also the variant known as Miniconda, which contains only Python, Conda, and a few basic packages. Both variants are completely free and open source.
We need around 400 MB of free space to download and install MiniConda3.
Steps to install MiniConda3 on Ubuntu 20.04 LTS
Before following this tutorial ensure that you have Python installed on your Ubuntu system. Although, it would be because python version 3.x is already there on Ubuntu 20.04 out of the box. If not then you can use the APT package manager to install it, here is the command-
sudo apt install python3
1. Update Ubuntu 20.04
Well, this step is not necessary to install MiniConda because here we are going to use the script available for it, officially. However, still to ensure the system is up to date with available security updates for our Ubuntu 20.04 run the command once.
sudo apt update && sudo apt upgrade
2. Download MiniConda Script
MiniConda is not available to install using the APT package manager and standard repository of Ubuntu. Hence, we download the script published on the official document website of Anaconda. Here is the command to directly download it using the command terminal of Ubuntu 20.04.
3. Install MiniConda3 on Ubuntu 20.04
Now, we can install the MiniConda using the script for our current user.
Hit the Enter key to start the installation process. Soon, the installer will ask to accept the License, press q, and then type Yes to accept it.
The setup will also you – “Do you wish the installer to initialize Miniconda3 by running Conda init?” If you type Yes then every time you open the Terminal, Conda’s base environment will be activated on startup and also this will add the Conda3 folder path in your bash profile. Hence, it is recommended to type –Yes
Whereas those who don’t want it, can type “No” and hit the Enter key.
Trivia: In case you have activated the base environment of Condo to start every time with terminal and now you want to deactivate it, then here is the command to follow:
conda config --set auto_activate_base false
Close and reopen the terminal to start using the Conda package manager
4. Check Conda Version
Once the installation is completed, we can check the version installed of this Python package manager on our system.
5. How to create a New environment
Now, if you want to create an environment for your project with a particular python version and libraries then here is the way to do that.
conda create -n myfirstenv python
In the MiniConda, Python 3 is denoted or set as default python.
Once created, you can activate the environment using the command:
conda activate myenv
Note: To deactivate the environment use:
6. Use Conda to install the library for Python
If you want to use Conda package manager to install some other package or library then here is the command syntax for that.
conda install package-name
conda install numpy
7. How to update
To update the Conda package manager you can use its own command line:
conda update conda
7. Uninstall or Remove Miniconda3 – Ubuntu 20.04
To remove Miniconda3 from your Ubuntu 20.04, simply delete the folder containing its files. After that remove it from your system $PATH as well.
rm -rf ~/miniconda3
Remove the Conda Initialize code from your bash profile.
Find the lines shown in the screenshot and delete them.
After that save the file using Ctrl+O, hit the Enter key, and use Ctrl+X.
Close the Terminal and start it again or simply source the Bash using: