0% found this document useful (0 votes)
474 views2 pages

Conda Cheatsheet

The document provides a cheat sheet for using the conda package and environment manager. It lists conda commands for installing and managing packages and environments, including creating, activating, and deleting environments. It also describes how to install different versions of packages and Python, and find and install packages from the Anaconda repository or PyPI.

Uploaded by

Abhigyan Raman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
474 views2 pages

Conda Cheatsheet

The document provides a cheat sheet for using the conda package and environment manager. It lists conda commands for installing and managing packages and environments, including creating, activating, and deleting environments. It also describes how to install different versions of packages and Python, and find and install packages from the Anaconda repository or PyPI.

Uploaded by

Abhigyan Raman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CONDA CHEAT SHEET

Take a conda test drive at bit.ly/tryconda


For full documentation of any command, type the command followed by --help ,
such as conda create --help

TIP: Anaconda Navigator is a point-and-click way to manage packages and environments with conda. For example, with Navigator you can
run Jupyter Notebooks or Spyder without using a terminal. If you have Anaconda, Navigator is already installed. Double-click the Navigator
icon on your desktop

MANAGING CONDA & ANACONDA


Verify conda is installed, check version number, conda info
see basic information about conda
Update conda to the current version conda update conda
Update all packages in the environment to the versions conda update anaconda
in the latest release of Anaconda, all of which are tested
for compatibility. May not contain the newest versions.

USING ENVIRONMENTS
Get a list of all my environments, active conda info --envs
environment is shown with *
List all packages and versions installed in active environment conda list
Create an environment named bio-env in your home conda create --prefix ~/bio-env biopython
directory and install the biopython package
NOTE: Environments install by default into the envs
directory in your conda directory. You can specify a
different path; see conda create --help for details.

Activate the new environment to use it LINUX, MAC: source activate ~/bio-env
WINDOWS: activate ~/bio-env
Create a new environment named py34, specify conda create --prefix ~/py34 python=3.4 astroid
Python version, install astroid package
Make exact copy of an environment conda create --prefix ~/bioenvcopy --clone bio-env
Deactivate the current environment LINUX, MAC: source deactivate
WINDOWS: deactivate
List the history of each change to the current environment conda list --revisions
Restore the environment to a previous revision conda install --revision 2
Delete an environment method 1 conda remove --prefix ~/bioenvcopy --all
Delete an environment method 2 LINUX, MAC: rm -rf ~/bioenvcopy
WINDOWS: rmdir /s bioenvcopy
Save environment to a text file conda list --explicit > bio-env.txt
Load environment from a text file conda create --prefix ~/bio-env --file bio-env.txt

FINDING CONDA PACKAGES


Go to Anaconda Cloud in the browser https://anaconda.org
and search by package name
Use conda to search for a package (Numba) conda search numba
View list of all packages associated with Anaconda https://docs.continuum.io/anaconda/pkg-docs

CONTINUED ON BACK
INSTALLING PACKAGES
Install a new package (Jupyter Notebook) conda install jupyter
in the current environment
Run an installed package (Jupyter Notebook) jupyter-notebook
Install a new package (toolz) in a conda install --prefix ~/bio-env toolz
different environment (~/bio-env)
Update a package in the current environment conda update toolz
Install a package (boltons) from a conda install -c conda-forge boltons
specific channel (conda-forge)
Install a package directly from PyPI into the pip install boltons
current active environment using pip
Remove one or more packages (toolz, boltons) conda remove --prefix ~/bio-env toolz boltons
from a specific environment (~/bio-env)
NOTE: If you do not include the path of the environment
(~/bio-env), conda removes packages from the current
active environment.

MANAGING MULTIPLE VERSIONS OF PYTHON


Install different version of Python in a conda create --prefix ~/py34 python=3.4
new environment named py34
Switch to the new environment that LINUX, MAC: source activate ~/py34
has a different version of Python WINDOWS: activate ~/py34
Show the locations of all versions of Python LINUX, MAC: which -a python
that are currently in the PATH WINDOWS: where python
NOTE: The first version of Python in the list will be executed.

Show version information for the current active Python python --version

SPECIFYING VERSION NUMBERS


Ways to specify a package version number for use with conda create or conda install commands, and in meta.yaml files.

Constraint type Specification Result


Fuzzy numpy=1.11 1.11.0, 1.11.1, 1.11.2, 1.11.18 etc.
Exact numpy==1.11 1.11.0
Greater than or equal to "numpy>=1.11" 1.11.0 or higher
OR "numpy=1.11.1|1.11.3" 1.11.1, 1.11.3
AND "numpy>=1.8,<2" 1.8, 1.9, not 2.0

NOTE: Quotation marks must be used when your specification contains a space or any of these characters: > < | *

MORE RESOURCES
Free Community Support https://groups.google.com/a/continuum.io/forum/#!forum/anaconda
Online Documentation http://conda.io
Paid Support Options https://www.continuum.io/support
Continuum Onsite Training Courses https://www.continuum.io/training
Continuum Consulting Services https://www.continuum.io/continuum-consulting

Follow us on Twitter @continuumio and join the #AnacondaCrew!


Connect with other talented, like-minded data scientists and developers while
contributing to the open source movement. Visit https://continuum.io/community

Continuum.io [email protected] 512-776-1066


1/20/2017 Conda Cheat Sheet Version 4.3.1

You might also like