Personal Wiki
Python Tools
Conda

Conda

This document serves as a quick reference guide for using Conda, a package and environment management system. Conda is commonly used for managing Python packages, but it can also manage packages from other languages. It allows you to create isolated environments with different package versions and dependencies.

Installation

To install Conda, follow the instructions for your operating system from the official Conda documentation:

Environment Management

  • Create a new environment:

    conda create --name myenv

    For specifying a specific Python version:

    conda create --name myenv python=3.8
  • Activate an environment:

    conda activate myenv
  • Deactivate the current environment:

    conda deactivate
  • List all environments:

    conda env list
  • Remove an environment:

    conda env remove --name myenv
  • Create a requirements.txt file:

    conda list --explicit > requirements.txt
  • Create an environment from a requirements.txt file:

    conda create --name myenv --file requirements.txt
  • Export an environment to a YAML file:

    conda env export --name myenv > environment.yml

    The resulting YAML file can be used to recreate the environment.

Package Management

  • List installed packages:

    conda list
  • Install a package:

    conda install packagename

    For specifying a specific version:

    conda install packagename=1.2.3
  • Update a package:

    conda update packagename
  • Remove a package:

    conda remove packagename
  • Search for a package:

    conda search packagename

Managing Channels

Conda uses channels to find and install packages. Here are some commands for managing channels:

  • Add a channel:

    conda config --add channels channelname
  • Remove a channel:

    conda config --remove channels channelname
  • List configured channels:

    conda config --get channels

Miscellaneous Commands

Here are a few more commands that can be handy:

  • Update Conda itself:

    conda update conda

Further Reading

For more detailed information on Conda and its usage, refer to the official Conda documentation:

;