Skip to content

Instantly share code, notes, and snippets.

@valyakuttan
Created August 18, 2023 17:30
Show Gist options
  • Save valyakuttan/cbdc359853bac6dc02f322fc16f0273d to your computer and use it in GitHub Desktop.
Save valyakuttan/cbdc359853bac6dc02f322fc16f0273d to your computer and use it in GitHub Desktop.

conda cheatsheet

conda Installation

  • verify conda install and check version

    
    $ conda info
    
    

Channels and Packages

  • List installed packages

    
    $ conda list
    
    
  • List installed packages with source info

    
    $ conda list --show-channel-urls
    
    
  • Install a package from specific channel

    
    $ conda install -c CHANNELNAME PKG1 PKG2
    
    
  • Uninstall package

    
    $ conda uninstall PKGNAME
    
    
  • Add a channel

    
    $ conda config --add channels CHANNELNAME
    
    
  • Set default channel for pkg fetching

    
    $ conda config --set channel_priority strict
    
    

Conda Environments

  • List all environments and locations

    
    $ conda env list
    
    
  • Create a new environment

    
    $ conda create --name ENVNAME
    
    
  • Activate environment

    
    $ conda activate ENVNAME
    
    
  • Create environment with python version

    
    $ conda create -n ENVNAME python=3.12
    
    
  • Rename environment

    
    $ conda rename -n ENVNAME NEWENVNAME
    
    
  • Delete environment by name

    
    $ conda remove -n ENVNAME --all
    
    
  • Create a new anaconda env from yaml file

    
    $ conda env create -f environment.yaml
    
    
  • An example environment.yaml file

    name: em_env
    channels:
      - conda-forge
      - defaults
      - mro
    dependencies:
      - jupyterlab=0.35.*
      - matplotlib=3.0.*
      - openpyxl=2.6.*
      - pip=19.0.*
      - pip:
         - pycryptodomex==3.8.1
         - pytest-mpl==0.10.*
         - pytest-cov==2.6.*
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment