Skip to content

Instantly share code, notes, and snippets.

@sachit-singh
Forked from puncoz/anaconda.md
Created March 21, 2018 08:49
Show Gist options
  • Save sachit-singh/7fccdc39011dc4daff8d778a4f3d2087 to your computer and use it in GitHub Desktop.
Save sachit-singh/7fccdc39011dc4daff8d778a4f3d2087 to your computer and use it in GitHub Desktop.
Anaconda Basic Commands for linux

Anaconda Commands

1. Managing Environments

Refer official docs [https://conda.io/docs/user-guide/tasks/manage-environments.html]

Help

conda create --help

Creating Environment

To create an environment:

conda create --name myenv

To create an environment with a specific version of Python:

conda create -n myenv python=3.4

To create an environment with a specific package:

conda create -n myenv scipy

or,

conda create -n myenv python
conda install -n myenv scipy

or,

conda create -n myenv python=3.4 scipy=0.15.0 astroid babel

If you do not want the default packages installed in a particular environment, use the --no-default-packages flag:

conda create --no-default-packages -n myenv python

Creating an environment from an environment.yml file

conda env create -f environment.yml

Cloning an environment

conda create --name myclone --clone myenv

List of all environment

conda info --envs

or,

conda env list

Activating an environment:

source activate myenv

Deactivating an environment

source deactivate

Viewing a list of the packages in an environme

conda list -n myenv

or, if environment is activated

conda list

Removing an environment

conda remove --name myenv --all

or,

conda env remove --name myenv

Managing in requirements.txt

To create a requirements.txt file:

conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder

To export environment file

activate <environment-name>
conda env export > <environment-name>.yml

For other person to use the environment

conda env create -f <environment-name>.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment