wiki:hpc:conda
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | wiki:hpc:conda [2021/08/04 08:10] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Conda ====== | ||
+ | [[https:// | ||
+ | |||
+ | This guide is focused on Python programs, but conda is not limited to those. | ||
+ | |||
+ | **Note**: | ||
+ | |||
+ | |||
+ | ==== Quickstart ==== | ||
+ | |||
+ | This section provides a minimal example on how to use conda. | ||
+ | |||
+ | <code bash> | ||
+ | # load the anaconda module (this gives you the default version, | ||
+ | # use e.g. anaconda3/ | ||
+ | module load anaconda3/ | ||
+ | |||
+ | # create a new environment named ' | ||
+ | conda create -n my_env | ||
+ | |||
+ | # activate the freshly created environment | ||
+ | source activate my_env | ||
+ | |||
+ | # install packages to my_env | ||
+ | conda install numpy matplotlib | ||
+ | |||
+ | # now you can use the packages you installed | ||
+ | |||
+ | # exit the environment | ||
+ | source deactivate | ||
+ | </ | ||
+ | |||
+ | ==== Creation of environments ==== | ||
+ | |||
+ | After loading the conda module, one can create a new environment in different ways (of course you can use a different name than ' | ||
+ | <code bash> | ||
+ | # using a name, the environment will be created in $HOME/ | ||
+ | conda create -n my_env | ||
+ | |||
+ | # to create the environment in a specific location, execute one of the following: | ||
+ | conda create -p / | ||
+ | conda create -p my_env # path relative to the current working directory | ||
+ | |||
+ | # create a new environment with packages (here: deeptools and all its dependencies) | ||
+ | conda create -n my_env deeptools | ||
+ | |||
+ | # create a new environment for a specific python version | ||
+ | conda create -n py27_env python=2.7 | ||
+ | </ | ||
+ | |||
+ | ==== Using pip for software management ==== | ||
+ | |||
+ | Although the conda module already includes pip (a very old version), it's better to install it in an environment. | ||
+ | |||
+ | <code bash> | ||
+ | # load the anaconda3 module | ||
+ | module load anaconda3 | ||
+ | |||
+ | # create an environment containing a recent version of pip | ||
+ | # note that you could use a different name than ' | ||
+ | conda create -n pip_test pip | ||
+ | |||
+ | # activate the environment (change the name accordingly) | ||
+ | source activate pip_test | ||
+ | |||
+ | # install some packages using pip | ||
+ | # ' | ||
+ | pip install --user tensorflow | ||
+ | </ |
wiki/hpc/conda.txt · Last modified: 2021/08/04 08:10 by 127.0.0.1