Skip to content

Instantly share code, notes, and snippets.

@puncoz
Last active December 29, 2018 08:48
Show Gist options
  • Save puncoz/60a0fff1aac533e921df22ebcdb8e889 to your computer and use it in GitHub Desktop.
Save puncoz/60a0fff1aac533e921df22ebcdb8e889 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

To add and install package from different channel

conda config --add channels conda-forge 
conda install <package-name>

or, just install package

conda install -c <channel-name> <package-name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment