Development Skills
  • Development Skills
  • Server-side
    • Reverse SSH
    • Let's encrypt with Nginx
    • Miniconda
    • OpenSSL
    • Windows Skills
    • Crobtab
  • Set up Workspace
    • Setup basic environment
  • Bandit - Check your code's safeness
    • Introduction
    • Getting Started
    • Usage
    • Banditfile
    • Tailor-made testing
    • Tailor-made blacklist
    • Tailor-made formatter
    • Reference
Powered by GitBook
On this page
  • Installation
  • Enhance the Miniconda
  • How to use
  • Create a fresh environment
  • Activate the virtual environment
  • Install modules
  • Use pip to install modules
  • Backup environment dependencies and installed packages
  • Supplementary: Using miniconda with Nodejs
  1. Server-side

Miniconda

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

PreviousLet's encrypt with NginxNextOpenSSL

Last updated 7 years ago

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

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 config --add channels anaconda

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

$ conda install -c conda conda-env

How to use

Create a fresh environment

To create a new virtual environment, use

$ conda create -p <name of env> python=3.6

A new folder will created in the current working directory.

Activate the virtual environment

At the same level of virtual environment directory, run

$ activate <environment name>

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

$ bash activate <environment name>

or

$ source activate <environment name>

Install modules

Use Conda to install modules

$ conda install -n <name of env> <module name>

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

Use pip to install modules

$ pip install <module name>

You must activated the environment

Backup environment dependencies and installed packages

This section will make use of condo-env

Export Environment Config with Dependencies

$ conda env export -p <name of env> --no-builds > config.yml

Restore the backup environment from config file

Create Environment from config

$ conda env create -p <name of env> -f config.yml

Supplementary: Using miniconda with Nodejs

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

conda create -p nodejs -c conda-forge nodejs=8

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

Using condo-forge can search more version.

Conda — documentation
conda-forge