Setting up a robust Machine Learning (ML) development environment is crucial for seamless experimentation, training plus testing, and later deployment.
Miniconda, a lightweight distribution of the Conda package manager, offers a minimalistic yet industry-grade powerful approach to constructing such ML platforms.
This article will guide you through the process of setting up a basic machine-learning environment using Miniconda and Python.
But first…
Miniconda is a distribution of Conda, a cross-platform package manager that simplifies the installation and management of software packages and dependencies. Unlike Anaconda, which comes bundled with a comprehensive collection of pre-installed packages, Miniconda provides a barebones installation, allowing users to select and install only the packages they need.
I have used Anaconda in the past when I began learning ML. But I am not a fan of it at all. It slows down the computer significantly and installs many unwanted packages and stuff. Even installing or upgrading something using Anaconda looks easy at first because of its GUI nature, but almost always hits a roadblock due to multiple dependencies issues.
In the following, I will guide the Miniconda-based installation of Jupyter Lab, Python, and relevant ML and Python packages will get you ready to run your first ML code within half an hour.
First download and install Miniconda via the official link (https://docs.conda.io/projects/miniconda/en/latest/). Select the appropriate version for your operating system.
One notable absence from Miniconda is Jupyter Lab. It is a powerful, and interactive programming and computing environment. To fill this gap, we need to install Jupyter Lab from within Miniconda.
Open a Miniconda terminal (See the figures after the command). On Windows OS, click the Start button and use the following command.
conda install -c conda-forge jupyterlab
The above command leverages the conda-forge channel, a community-driven collection of conda packages, to install Jupyter Lab and its dependencies.
With Miniconda open, let’s proceed to install essential ML libraries such as Pandas, Keras, Scikit-Learn, and TensorFlow etc. Conda-forge is recommended for this task due to its advantages over traditional pip installations.
conda install -c conda-forge pandas
conda install -c conda-forge tensorflow
conda install -c conda-forge scikit-learn
conda install -c conda-forge keras
conda install -c conda-forge seaborn
conda install -c conda-forge matplotlib-base
conda install -c conda-forge scikit-learn
Note: Some other relevant packages would also be need installation at a later stage. The good thing about conda installation is that it will automatically install all the dependencies. Hence, when you install the pandas, Numpy package will be installed automatically.
Other advanced packages could be installed mostly through conda command, but that discussion is out of our current scope.
To see the installed packages and libraries. Type the following command
conda list
Conda-forge offers a curated collection of packages that are rigorously tested for compatibility and stability. Unlike pip, Conda handles both Python and non-Python packages, ensuring a smoother integration of libraries with native dependencies. Additionally, Conda resolves package conflicts and manages environment configurations more efficiently, providing a reliable and reproducible development environment.
By leveraging the simplicity of Miniconda and the reliability of conda-forge, you can swiftly set up a basic ML platform tailored to your needs. This minimalistic approach not only conserves resources but also enables you to build a customized environment that suits your specific ML endeavors.
Happy coding!