Conda Cheatsheet



Some definitions

Conda deactivate my-dev-env. Search for packages. Conda search searches whatever channels are configured (at least, that is the default channel) conda search -channel searches the package also in the specified channel. Conda config -add channels Update a Conda environment.

Conda is an open source package manager tool and environment management system. It is mostly used for created isolated Python environments but it can package and distribute software for any language.

Anaconda is a free and open-source Python distribution for scientific computing. It includes conda and plus hundreds of popular Python packages such as numpy, scipy, matplotlib, pandas, etc…

Miniconda is a lighter alternative to Anaconda that just include conda and its dependencies but no Python packages.

View AnacondaCheatSheet from ACG 785016 at Miami Dade College, Miami. ANACONDA CHEAT SHEET See full user documentation for Anaconda docs.continuum.io/anaconda BEFORE YOU. View conda-cheatsheet from EE 361M at University of Texas. Conda user cheat sheet Take a conda test drive at bit.ly/tryconda For full documentation of any command, type the command followed. Conda remove -name snakes -all Remove an environment Conda user cheat sheet Managing packages, including Python conda list View list of packages and versions installed in active environment conda search beautiful-soup Search for a package to see if it is available to conda install conda install -n bunnies beautiful-soup Install a new package. To use conda on Windows XP, select Anaconda 2.3.0 and see Using conda on Windows XP with or without a proxy. GUI versus command line installer ¶ Both GUI and command line installers are available for Windows, macOS, and Linux.

A virtual environment is a named, isolated, working copy of Python that that maintains its own files, directories, and paths so that you can work with specific versions of libraries or Python itself without affecting other Python projects. Virtual environments make it easy to cleanly separate different projects and avoid problems with different dependencies and version requirements across components.

Please see the official page for more information.

Other environment managers

virtualenv is a tool to create isolated environments for Python only.

venv is a tool to create isolated environments for Python 3 only.

Cheat sheet

Create environment

List environments

Activate environment

Deactivate environment

View a list of the packages in an environment

Export a .yml environment file

Remove an environment

Check conda version

Update conda

You may want to create a Conda environment to share with all your group members. In this case you will need to create the environment in a new location. You can do this with the –prefix command. For example:

conda create –prefix $SCRATCH/../conda/envs/<environment_name>This will create the environment in the root of your group’s scratch directory. To activate this environment requires a little more typing since it’s not in the standard location for Conda environments

source activate /panfs/pfs.local/scratch/<your_group>/conda/envs/<environment_name>

Conda Env Create

Commonly used python libraries¶

Ignore python warning

export PYTHONWARNINGS=”ignore”

Save fig¶

Create package¶

I recently created a pip package and it can be easily converted to a conda package.

The package name is unique_color. However, when upload it to pypi, its name becomes unique-color. And when conda-build trying to download the package, from this url: https://files.pythonhosted.org/packages/source/u/unique_color/unique-color-3.0.tar.gz. This url is not exist, which should be https://files.pythonhosted.org/packages/source/u/unique-color/unique_color-3.0.tar.gz. Apparently, the package name could be - or _, but the file name can only be the one you specified in setup.py.

So the steps are:

Conda Check Env

  1. pypi

If you want to update package description, you have to create a new release.

  1. conda

I found “activate a conda env and then conda build” leads to a conda package missing dependencies.

conda-build is slow, for changeseq, it took 20min to finish.

condaskeletonpypiunique-color will create meta.yaml in unique-color folder. To enforce a specific python version, you can create a file called conda_build_config.yaml, and put:

To add any dependencies, edit meta.yaml file, add specific libraries (which can be installed through conda or pip).

Example¶

## For my Macbook

Conda CheatsheetConda Cheatsheet

/Users/yli11/opt/anaconda3/bin/anaconda

Conda Cheat Sheets

Contribute to bioconda¶

ref:

How to use other installed conda (other people’s conda)¶

Conda Command Line Cheat Sheet

Use Helvetica¶

code @ github.