Miniconda

In this article, I will introduce Miniconda to create a virtual development environment.

Miniconda is a very useful tool for developers. It is a repository management system without any packages. If you would like to use pre-shipped packages, you better choose Anaconda, a distribution with some common built in packages.

Package, dependency and environment management for any language—Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN — Conda Official Description

For my personal preference, I would choose Miniconda which provides a fresh and clean virtual environment for me to decide what packages should be installed. Some people may think that Miniconda is for Python, however, it is not true. For example, Nodejs can also be used with it. I will introduce the basic usage of Miniconda in the coming section. If you want to go deeper, you can check Conda — documentation

Installation

Before starting to use the miniconda, we have to go Miniconda — Conda to download and install the binary installer.

If you are using linux or Mac OS, you have to use bash installer. But don’t worry, it is easy! Just download and run in terminal and then everything is done.

Enhance the Miniconda

After the installation, I recommend to install the following items to enhance Miniconda

A community driven packaging for conda.

Used for searching the updated package. It is used for replace the original official channel.

$ conda config --add channels conda-forge

  • anaconda Anaconda channel

  • conda-env Provides a unified interface to dealing with Conda environments. Used for managing the environment.

How to use

Create a fresh environment

To create a new virtual environment, use

A new folder will created in the current working directory.

Activate the virtual environment

At the same level of virtual environment directory, run

If you are use Mac or Linux based OS, you should use

or

Install modules

Use Conda to install modules

You must be at the same level directory of virtual environment.

Use pip to install modules

You must activated the environment

Backup environment dependencies and installed packages

This section will make use of condo-env

Export Environment Config with Dependencies

Restore the backup environment from config file

Create Environment from config

Supplementary: Using miniconda with Nodejs

Besides Python, conda can help to create the Virtual Environment for nodejs. You can create it with

Since default conda create -p nodejs nodejs only have version 6, but the latest LTS is 8

Using condo-forge can search more version.

Last updated