In the world of data science and Python development, Anaconda has long been a popular choice due to its comprehensive package management and environment management capabilities. However, recent changes in Anaconda's licensing policies have made some organizations with more than 200 employees, look for alternatives. Who wants to pay 600USD for one license!! An alternative is to use Miniconda, a lightweight version of Anaconda, in combination with the conda-forge
channel. This setup provides a flexible and open-source approach to managing Python packages and environments.
In this blog post, I'll guide you through the process of setting up Miniconda with conda-forge
to avoid Anaconda's licensing issues.
MINICONDA
Miniconda is a minimal installer for conda, an open-source package management system and environment management system. While Anaconda comes with a large number of pre-installed packages, Miniconda includes only conda and its dependencies. This allows users to create custom environments with just the packages they need, keeping things lightweight and manageable.
CONDA-FORGE
Conda-forge is a community-led collection of recipes, build infrastructure, and distributions for the conda
package manager. The conda-forge
channel provides a vast array of packages and is completely open-source, which helps in avoiding any potential licensing issues that might arise with using Anaconda's default repository.
SETTING UP
First remove Anaconda from your system. And then follow these steps to set up Miniconda with conda-forge
:
Step 1: Download and Install Miniconda
You can install miniconda
by following the steps listed here.
Step 2: Initialize Conda (if not done during installation)
If you didn't initialize Miniconda during the installation, you can do it manually by running:
conda init
This command modifies your shell startup file (e.g., .bashrc
, .zshrc
, or .bash_profile
) to enable conda in your shell sessions.
Step 3: Add Conda-Forge as the Default Channel
To configure conda
to use conda-forge
as the primary channel, run the following command:
conda config --remove channels defaults
conda config --add channels conda-forge
conda config --set channel_priority strict
This command removes the defaults
channel, which is causing the license issue, adds conda-forge to the list of channels and sets it as the highest priority channel, ensuring that packages are installed from conda-forge by default.
Step 4: Create a New Environment
With conda-forge configured, you can create a new environment. For example, to create an environment named myenv
with Python 3.9, you can run:
conda create -n myenv python=3.9
Activate the environment with:
conda activate myenv
Check the channels and make sure defaults
is not mentioned.
conda config --show channels
Step 5: Install Packages from Conda-Forge
Now you can install packages from conda-forge
. For instance, to install NumPy and Pandas, use the following command:
conda install numpy pandas
Conda will resolve dependencies and install the specified packages from conda-forge.
Step 6: Verify Package Sources
To ensure that the packages are being installed from conda-forge, you can use the conda list
command to list the installed packages along with their channels:
conda list
Look for the channel
column in the output to verify that packages are being sourced from conda-forge.
CONCLUSION
Using miniconda
with conda-forge
is a powerful combination that allows you to avoid the licensing issues associated with Anaconda while still leveraging the full power of the conda
package and environment management system. By following the steps outlined in this blog post, you can set up a flexible and open-source Python development environment tailored to your specific needs.
Top comments (0)