Skip to content

Instantly share code, notes, and snippets.

@steven2358
Last active December 27, 2023 22:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steven2358/0e8e43ea392026b373dbceb4728abd94 to your computer and use it in GitHub Desktop.
Save steven2358/0e8e43ea392026b373dbceb4728abd94 to your computer and use it in GitHub Desktop.
Conda environment commands

Conda environment commands

https://conda.io/docs/index.html

Create environment

conda create --name my_environment python=3
activate my_environment

To find necessary packages for a given script:

python my_file.py

For each necessary package we can first search, e.g.

conda search autograd

And then install them, e.g.

conda install autograd
conda install matplotlib
conda install brewer2mpl
conda install pandas
conda install tqdm
conda install scikit-learn
conda install spyder
conda install GPy
pip install GPyOpt

Roll back to a previous revision

First, get a list of the revisions:

conda list --revisions

Then, install the previous revision (second-to-last in the previous list):

conda install --revision N

Export the environment file

conda env export > environment.yml

Create environment from file

conda env create -f my_environment.yml

This loads environment from yaml configuration file.

Activate environment

activate my_environment

Deactivate environment

deactivate

Remove environment

conda remove --name my_environment --all

Update environment from YML file

source activate myenv
conda env update -f=local.yml

List all environments

conda env list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment