Install MiniConda & setup Environment for Machine Learning

install-miniconda-with-jupyter-notebook-for-machine-learning

MiniConda is a package management and installation system for machine learning libraries and tools. It provides an easy way to install and update libraries. In this tutorial, I will show you how to install MiniConda and set up the best environment for machine learning with little space without losing efficiency.

For data science and coding, I use a Windows machine. So I can only guide you to set up the MiniConda environment for the Windows machine.

I honestly don’t know how useful this lesson will be if you use Linux or Mac. But, I believe you can use the same configuration for those type of machines after installing MiniConda for linux or mac.

MiniConda vs Anaconda

There are two main contenders in the market for data analysis tool – Anaconda and MiniConda. Each of these tools has its own advantages and disadvantages, so it’s important to understand which one is right for you before you start installing it on your computer.

What is Anaconda?

Anaconda is the best software for machine learning with Python. If you have a good and high-speed PC with a good amount of space, you can click here to download Anaconda software for specific python versions (Python 3, Python 2, etc.) and install it on your computer.

Anaconda has all the tools and python libraries (required for data science) like NumPy, SciPy, Matplotlib, etc. inside its stomach. If you need to use any extra libraries you can install them by running pip install or conda install command in command prompt or Anaconda prompt respectively.

If you don’t want to use command prompt, you can use GUI-based Anaconda Navigator to install any extra libraries, create virtual environment, etc.

Also Read:  What is Reinforcement Learning in Machine Learning

No doubt Anaconda is the best tool for data science or data analysis but one major disadvantage of using Anaconda is that the installation procedure can take several hours to complete.

Also if you are using a slow machine with low RAM then anaconda will definitely give you some trouble because Anaconda is a heavy-weight software.

What is MiniConda?

MiniConda on the other hand is a lightweight Python distribution that contains the basic packages (the total number of packages is less than Anaconda but enough) that are needed for data science projects.

It is designed to run on small computers with limited RAM and disk space, making it ideal for data analysts who don’t have a lot of time on their hands and prefer to run their analysis program quickly and efficiently.

It also supports a wide range of programming languages and tools, allowing you to choose the one that’s most suitable for your needs.

Another advantage of using MiniConda is that it requires a relatively shorter installation process than Anaconda, which means that you won’t have to wait around for hours before you can start using the program.

Like Anaconda it also provides you with extensive support for multiple operating systems, including Windows, macOS, and Linux.

Setup ML environment with MiniConda

Let me now show you the steps which I followed for setting up a machine-learning environment with MiniConda.

System Requirement

  • License: Free to use and redistribute under the end user license agreement of Miniconda.
  • Operating system: Windows 8 or latest, 64-bit macOS 10.13+, or Linux (including RedHat, Ubuntu, CentOS 7+, and others).
  • If your operating system is older than what is presently supported, you can download an older version of Miniconda installers for MiniConda archive.
  • Minimum 400 MB disk space is required to download and install MiniConda.
Also Read:  Naive Bayes algorithm in Machine Learning with Python

MiniConda Download

To download MiniConda for any specific Python version click here.

MiniConda Installation

I think I do not need to tell you how to install any software. But one thing I need to highlight: while installing MiniConda, don’t forget to check the box which says “Add MiniConda to my PATH environment variable“.

miniconda-machine-learning-environment

So now that you installed MiniConda, now you need to install a code editor. I prefer to use Jupyter Notebook for data analysis which is one of the best IDE for machine learning and data analysis.

To install Jupyter notebook, run the below command in your command prompt:

conda install jupyter

Whenever you wish to launch a Jupyter notebook, run the below command in your terminal:

jupyter notebook

A notebook will then be launched in your default browser.

Now, you can install any additional Python libraries that are necessary for your project. You can download any required python library by running the below command:

conda install package_name

You can put the name of the library you want in place of package_name. For example, here’s how to install Python libraries for a Named Entity Recognition project with Spacy.

conda install numpy
conda install pandas
conda install -c conda-forge spacy

etc.

Create a separate environment

A virtual environment is a tool that helps to keep libraries required for different projects separate by creating isolated virtual environments for them. This is one of the most important and popular tools that most Python developers use.

Imagine the scenario where you are working on two web-based Python projects, one of which utilizes Django 1.9 and the other Django 1.10, and so on. In such cases, a virtual environment may be quite beneficial in maintaining the dependencies of both projects.

Also Read:  Neural network from scratch in Python

To create a virtual environment you can run the below commands:

conda create -n ENV_NAME python=3.6.3

You can replace ENV_NAME with your desired environment name.

Now if you want to work inside that particular virtual environment, you have to activate that environment. To do that run the following command.

activate ENV_NAME

If you want to learn more about virtual environment read this post: Conda Virtual Environment Cheatsheet

That’s it. You now have all of the instruments you need to start your first machine learning project. Go and start coding now!

Conclusion

This post showed you how to install MiniConda and set up a good environment to work for your first data science project. If you are still confused about Anaconda vs MiniConda please let me know your question in the comment section below.

Leave a Comment

Your email address will not be published. Required fields are marked *