There are many tools to help us with the management of packages needed by applications. Some of these focus on a specific programming language and others are rather agnostic. So, speaking of the agnostic ones, we present Conda for Linux. This is a post where we will tell you about this cool tool and discuss how to install it, how to use it, and so on.
Conda is an open-source package management system that runs on Windows, macOS, and Linux.
An essential feature of Conda is that it allows multiple versions of Python to be accessible simultaneously. In other words, it allows us to switch between various Python environments without the need to reinstall or remove packages.
Conda has excellent official documentation and also has a great community behind it that makes the support fabulous.
What is Conda used for?
Conda is a package manager, so the main use of it is for installing, upgrading, uninstalling, and managing packages which can be whole programs or simple libraries required by other environments. This means that we don’t have to waste time doing it manually and usually inaccurately.
One of the main differences between PIP and Conda is that pip installs source code files, whereas the packages that Conda installs are binary (i.e., already compiled). These packages are maintained in repositories such as repo.anaconda.com and conda-forge. But more package sources can be added.
In addition to this, Conda also allows you to discover new packages for your application or environment. However, Conda is not only limited to this is, but also goes much further.
An example of this is that Conda can be combined with continuous integration systems such as Travis CI and AppVeyor to provide frequent, automated testing of your code.
So, Conda is an important package manager that we can use to manage the dependencies of our application or environment. It can also manage Python virtual environments.
Is Conda different from Anaconda?
Anaconda is one of the best Python distributions. It is aimed at providing comprehensive support for scientific development with Python, both analytical and graphical. It provides everything you need to solve data processing and analysis problems (with Python applicability).
Anaconda is maintained and developed by the company Anaconda Inc, which is responsible for maintaining and evaluating the tool and the packages available from the Conda repository.
Therefore, Anaconda provides many Python configurations and default packages oriented to a specific field. But it is for the management of these packages that we need Conda.
In other words, within the whole Anaconda distribution is present the package manager that works as part of it, which is Conda.
So while Anaconda is the entire environment, Coda is only a part of this environment.
How to install Conda for Linux?
The process of installing Conda on Linux is subject to Anaconda. This process is simple and quick to do thanks to an installation script that is compatible with many Linux distributions.
Let’s get started.
First, open a terminal in your favorite Linux distribution. Then, make sure to update it completely.
If you are using Debian, Ubuntu, or one of its derivatives you can use the following command to update the system
sudo apt update
sudo apt upgrade
In case you use RHEL, Fedora, or Rocky Linux you have to run the following command
sudo dnf update
But if you are using openSUSE, then you have to run
sudo zypper up
Next, you need to install the curl package using the repositories of your distribution.
Now using the curl command download the installation script
curl --output anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
Thereafter, you can start the installation by running the script.
sudo bash anaconda.sh
As soon as you start the script, you will be welcomed and prompted for the version of Anaconda to install. When you press ENTER to continue, you will be presented with the license terms that you will have to accept.
The next step is to indicate the installation path, which by default points to the root directory. If you have root access, you can leave it there, but you can also install it in the HOME directory of your account.
There, the whole download and installation process of Anaconda will start. The installation time will depend on your computer and internet connection, but it shouldn’t take long.
You will then be asked if you want to start Anaconda3 at once. In my case, I have answered YES.
Now you will see a screen like this one where you are told that the installation has been successful. At once, the installer has configured your user so that you can now use Conda-related commands.
As I have used the user called user to perform the installation and I have chosen the HOME directory of the root, I have to change the session to this user.
su - root
Now refresh the bash settings for root by running
You will notice how the prompt changes, indicating that the Anaconda virtual environment has been activated. With this, we will have Conda installed on the system.
If you wish to check the installed version, just run
And if you want to check some packages, you can do it with
Finally, if you would like to update the whole environment you have to run
conda update –all
Then you can use Conda for your purposes.
Can I install conda without Anaconda?
The short answer is NO. Conda is part of the whole Python distribution that is Anaconda. A possible alternative to this problem is to install Miniconda which is a smaller version of Anaconda.
We have to remember that Conda is a part of Anaconda and although it doesn’t look like it, it is heavily dependent on Anaconda. So to enjoy Conda, we have to install either Anaconda or MiniConda.
Package managers are fundamental tools to facilitate the maintenance of the dependencies of a package or library. In this sense, we have Conda which looks like a pretty good one because it is agnostic, but it is strongly linked to Anaconda and Python.
Throughout this post, we have explained about Conda, its uses, and how to install it in a Linux distribution.