An Overview of the Reptile Family
If you are into scientific computing with Python, you’re likely familiar with Anaconda and its conda package manager. You might also be aware of miniconda, conda-forge, and mamba, but unsure of their distinctions and which is best suited for your needs. This post aims to provide clarity and assist you in navigating the different package managers available.
Anaconda
Anaconda is a widely used distribution of the Python programming language specifically designed for scientific computing. It includes not only the Python interpreter but also more than 250 packages that are commonly utilized in scientific computing.
For those new to Python or still getting the hang of it, Anaconda is an excellent place to begin. Installing it will give you the confidence of being in capable hands.
Once you have some experience with Python, you may require a more sophisticated option. However, if you reside in China, it is advisable to keep a copy of Anaconda due to internet censorship.
Conda
In addition to the 250 Anaconda packages that come pre-installed, you may need to use some uncommon packages that are specific to your field, such as a biostatistics package that may not be useful to others.
To obtain the desired packages, use Conda, the package manager that comes with Anaconda. Conda installs not only the target package but also its dependencies, which are the other packages required for it to function properly.
Did you know that Conda manages not only packages but also environments? With an environment manager, you can easily install various versions of Python or the same packages but with different versions.
Let’s say you prefer using Python 3.11 because of its speed, but your go-to biostatistics software only works with versions up to 3.10. To solve this problem, you can create two distinct environments for each Python version and install the biostatistics software exclusively with Python 3.10. This way, you can easily switch between the two environments depending on the project you’re working on.
Miniconda
Out of all the environments, there is a unique one known as the base
environment. This environment is generated automatically upon the installation of Anaconda, and it contains all the pre-installed packages by default.
To ensure proper functionality, it is advisable to install non-default packages in an environment separate from the base
. This means you should always have an additional environment besides the base
.
Installing packages in the base
environment is not recommended by many practitioners, and here’s a simple reason why. Unlike user-created environments, the base
environment does not have a dedicated directory with the same name. Consequently, packages installed in user-created environments are stored in their corresponding directory, while those installed in the base
environment are stored in the root directory.
Name | Path |
---|---|
base | /user/zhengwenjie/opt/ananconda |
tensorflow | /user/zhengwenjie/opt/ananconda/envs/tensorflow |
pytorch | /user/zhengwenjie/opt/ananconda/envs/pytorch |
This difference implies that the base
environment is not intended for users to directly use.
It is meant for the conda package manager to operate properly.
The base
environment is created for conda, which itself is a Python package.
It is recommended that users do not interact with the base environment.
Since you should pretend that base
does not exist, you should refrain from using any of its packages.
Essentially, it would be a waste of time to obtain and set up all 250 packages in the base
.
For this sake, the Miniconda installer was created.
It includes only the essential packages required for conda to operate.
When installed, it sets up the base
environment and installs these packages.
Once users have installed Miniconda, they can quickly create a new environment and download and install their preferred packages.
Conda-forge
Anaconda is a software developed by a company with the same name, Anaconda, Inc.
When you download packages, you obtain them from their maintained repository.
One limitation of using company-maintained repositories is that they may not have all the available packages or the latest versions.
For example, pandas
2.0 has been released, but Anaconda, Inc only provides version 1.5 as of the time of writing.
For this sake, communities have created a repository called conda-forge, which typically offers more up-to-date versions of packages than Anaconda. Additionally, conda-forge includes many packages that are not available in Anaconda. It is a reliable and mature repository, and we recommend prioritizing it.
Miniforge
Miniforge is an installer similar to Anaconda that merges the benefits of Miniconda and conda-forge. It functions as a preconfigured Miniconda installer with conda-forge set as the default repository.
Mamba
Mamba is a faster alternative to conda for downloading packages. Unlike conda, Mamba downloads packages in parallel, which makes the process quicker. You should consider using Mamba instead of conda for faster package installations. Additionally, Mamba employs conda-forge as the default repository, which is the same as Miniforge.
Mamba can be used in the same way as Conda. You can use all of your Conda commands with Mamba, but replace the conda
part with mamba
.
Micromamba
To work properly, both Conda and Mamba require Python and the conda/mamba package.
They also need a base
environment to host themselves.
On the other hand, Micromamba is a viable alternative to both Conda and Mamba.
It uses a C++ executable to offer similar features.
It does not need a base
environment and does not come with a default version of Python.
For this sake, Micromamba, as its name suggests, is much smaller in size compared to Conda and Mamba. It is frequently used in continuous integration.
Micromamba, like Mamba, uses conda-forge as its default repository.
The majority of conda/mamba commands are compatible with micromamba, but with the conda
/mamba
part replaced by micromamba
.
Micromamba has some limitations as it only supports a subset of conda/mamba commands.
This means that some important functionalities are missing.
For instance, its remove
command remove only packages within an environment but not the environment itself.
Additionally, Micromamba does not have a rename
command, and its create
command is lacking support for the --clone
argument.
The incompleteness of Micromamba stops many users from using it in daily use.
Despite this, I personally favor Micromamba over Conda/Mamba due to its autocompletion feature, which is currently unavailable in Conda and Mamba.
Any drawbacks of Micromamba can be easily overcome by following best practices and installing all packages outside the base
environment.
This will allow you to perform environment operations such as removal, renaming, or cloning through directory operations.
Conclusion
This article provided an overview of Python package management and introduced Conda, Mamba, Miniconda, Micromamba, and the conda-forge repository.
Prefix | Manager | Suffix |
---|---|---|
ana/mini | conda | forge |
micro | mamba | forge |
If you’re new to Python programming, I suggest using Anaconda. Otherwise, Mamba and Micromamba are great options for everyone else.