DEV Community

Cover image for Environment Manager - Conda
Maxime HEBRARD
Maxime HEBRARD

Posted on • Updated on

Environment Manager - Conda

If you are testing programmes or developping your own I strongly suggest to look after an environment manager. An easy way to install libraries into dedicated environments in isolation from each other, and to keep track of what is installed where. A whildely used environment manager is conda

Install on Windows

Before reading this post, I suggest you follow Ubuntu on Windows (WSL).

  • Open 'Ubuntu'
  • Download Miniconda installer for Linux
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
Enter fullscreen mode Exit fullscreen mode
  • Install miniconda
bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
Enter fullscreen mode Exit fullscreen mode
  • Press Enter to continue
  • Press Space to read through the licence
  • Key 'yes' to accept the licence
  • Press Enter to install miniconda3
  • Key 'yes' to confirm installation
  • Quit and restart 'Ubuntu'

At this point you will find a new information in your prompt that indicate in which conda environment you are currently in.

Win base

Install on MacOS

Before reading this post, I suggest you follow Improved Shell (MacOS).

  • Open 'Terminal'
  • Install miniconda from Homebrew
brew install --cask miniconda
Enter fullscreen mode Exit fullscreen mode
  • Configure conda for zsh
/opt/homebrew/bin/conda init zsh
Enter fullscreen mode Exit fullscreen mode
  • Quit and restart 'Terminal'

At this point you will find a new information in your prompt that indicate in which conda environment you are currently in.

macOS base

Usage

  • Update conda
conda update -n base -c defaults conda
Enter fullscreen mode Exit fullscreen mode
  • Create a new environment
conda create -n myEnvName
Enter fullscreen mode Exit fullscreen mode
  • Activate the environment
conda activate myEnvName
Enter fullscreen mode Exit fullscreen mode
  • Install libraries You can find libraries and how to install them either on Anaconda or pip
conda install ...
Enter fullscreen mode Exit fullscreen mode
pip install ...
Enter fullscreen mode Exit fullscreen mode
  • List all libraries in the current environment
conda list
Enter fullscreen mode Exit fullscreen mode
  • Exit an environment
conda deactivate
Enter fullscreen mode Exit fullscreen mode
  • Remove an environment
conda env remove -n myEnvName
Enter fullscreen mode Exit fullscreen mode
  • List the environements available
conda env list
Enter fullscreen mode Exit fullscreen mode

Next, I suggest you follow Cross Platform, Cross Language Text Editor - VSCode.

Top comments (0)