Skip to content

Why Conda ๐Ÿ

Conda is an open-source package manager available on multiple platforms, originally developed to address the challenges of package management faced by Python data scientists (which can be hard if you know what I mean ๐Ÿ˜…), it has grown to become a favored tool for managing Python and R packages like pip.

However, its utility extends to handling packages for any programming language. Conda facilitates the process of creating, locating, and installing the necessary packages.

In addition to package management, Conda serves as an environment manager. This is particularly useful when a package demands a different Python version than what is currently in use. With Conda, setting up and transitioning to a development environment tailored to the required Python version is straightforward, without the need to alter the Python version in the standard environment like virtualenv.

Although Conda's journey began as a component of the Anaconda Python Distribution, its utility in areas beyond just Python and R package management propelled it to gain recognition as an independent entity, subsequently being released as a standalone project under a BSD license. More on wikipedia.

Installation

The first thing to do if you want to use conda is to install it, and the easiest way to do this is to install either Anaconda or Miniconda, which both include Conda itself.

Once you have Conda installed, you can verify that your installation is working correctly with the command conda info ๐Ÿค“

Conda VS Miniconda VS Anaconda

Users are often confused about the differences between Conda, Miniconda, and Anaconda and it is normal ๐Ÿ˜…. The Planemo documentation has an excellent diagram that nicely demonstrates the difference between the Conda environment and package management tool and the Miniconda and Anaconda Python distributions that you can see bellow.

I suggest installing Miniconda which combines Conda with Python 3 (and a small number of core systems packages) instead of the full Anaconda distribution. Installing only Miniconda will encourage you to create separate environments for each project (and to install only those packages that you actually need for each project!) which will enhance portability and reproducibility of your research and workflows.

Integrating a Conda environment into your Jupyter Kernel

Firstly, let's establish a new Conda environment by executing the command below to create the environment named myCoolEnv with the version python 3.9.

conda create --name myCoolEnv python=3.9

Following the creation, you will observe an output indicating the environment's successful setup.

Tip

You can list all your cereated conda environement with the command conda env list it will show all the conda env set up on you local machine with their path ๐Ÿค“

Let's install a library let's say a transformers with a specific version like this :

conda install transformers=4.29.2

The next phase involves configuring your Jupyter notebook kernel to recognize the Conda environment. This can be accomplished by installing ipykernel like this :

conda install -c anaconda ipykernel

Subsequently, execute the command below to incorporate the Conda environment into your Jupyter notebook:

python -m ipykernel install --user --name=myCoolEnv

Verify the integration by launching your Jupyter Notebook. You should now be able to access and work within the myCoolEnv Kernel.

remove envs

You can also remove your cereated environements with the command conda env remove --name <yourSuperCoolEnv> it will remove all the env in your local machine ๐Ÿค“

More ressources about conda