| 29 | '''Because software installed via Conda may not be compatible with older operating systems, it's recommended to use the latest Anaconda distribution.''' |
| 30 | |
| 31 | ===== Using anaconda3/2023.07 ===== |
| 32 | * Start an interactive session on the CentOS7 node. |
| 33 | {{{ |
| 34 | idev --partition=centos7 -t 8 |
| 35 | }}} |
| 36 | This allocates a single CentOS 7 node for a duration of 8 hours. |
| 37 | * Load module, |
| 38 | {{{ |
| 39 | module load anaconda3/2023.07 |
| 40 | }}} |
| 41 | * Display the version of CONDA. |
| 42 | {{{ |
| 43 | $ conda --version |
| 44 | conda 23.7.3 |
| 45 | }}} |
| 46 | |
| 47 | == Basic Commands == |
| 48 | ||= Command =||= Description =|| |
| 49 | ||{{{ conda init }}}|| Initializing CONDA environment. || |
| 50 | ||{{{ conda info }}}|| Display the CONDA system info. || |
| 51 | ||{{{ conda --help }}}|| To learn about available built-in commands. || |
| 52 | ||{{{ conda env list }}}|| List all available environments. || |
| 53 | ||{{{ conda create –n VIRT_ENV }}}|| Create a virtual environment with the CONDA. || |
| 54 | ||{{{ source activate VIRT_ENV }}}|| Activate the CONDA virtual environment. || |
| 55 | ||{{{ conda install PACKAGE-NAME }}}|| Install some packages with the CONDA installation. || |
| 56 | ||{{{ conda deactivate }}}|| Deactivates the CONDA virtual environment. || |
| 57 | |
| 58 | == Configuring the CONDA environment on Cypress == |
| 59 | By default, Conda environments are stored in your home directory. However, we recommend using your group’s project directory instead. You can set the '''CONDA_ENVS_PATH''' environment variable to specify where Anaconda should create and locate your environments. For example: |
| 60 | {{{ |
| 61 | export CONDA_ENVS_PATH=/lustre/project/mygroup/myuser/conda-envs |
| 62 | }}} |
| 63 | Or {{{ conda config --add envs_dirs /path/to/envs }}} command does the same. For example: |
| 64 | {{{ |
| 65 | conda config --add envs_dirs /lustre/project/mygroup/myuser/conda-envs |
| 66 | }}} |
| 67 | By default, the package cache directory is created in your home directory, which will take up a large space as you use 'conda'. To change the package cache directory, |
| 68 | {{{ |
| 69 | conda config --add pkgs_dirs /lustre/project/mygroup/myuser/conda-pkgs |
| 70 | }}} |
| 71 | The configuration settings are stored in the ~/.condarc file. You can modify this file manually to customize Conda’s behavior. |
| 72 | |
| 73 | ||= Command =||= Description =|| |
| 74 | ||{{{ conda config --add envs_dirs /path/to/envs }}}|| Adding a desired path to the environment directory. || |
| 75 | ||{{{ conda config --add pkgs_dirs /path/to/pkgs }}}|| Adding a desired path to the package directory. || |
| 76 | ||{{{ conda config --remove envs_dirs /path/to/envs }}}|| Removing a desired path to the environment directory. || |
| 77 | ||{{{ vi ~/.condarc }}}|| Manually add paths to CONDA config file. || |
| 78 | |
| 79 | |
| 80 | == Installation commands == |
| 81 | ||= Command =||= Description =|| |
| 82 | ||{{{ conda install PACKAGE-NAME }}}|| Install a software package. || |
| 83 | ||{{{ conda install PACKAGE-NAME=version }}}|| Install a software package with a particular version. || |
| 84 | ||{{{ conda install PACKAGE-NAME=version –c CHANNEL}}}|| Install a software package with a particular version from a specific channel. || |
| 85 | ||{{{ conda install PACKAGE-NAME1 PACKAGE-NAME2 … }}}|| Install multiple packages. || |
| 86 | |
| 87 | |
| 88 | == Some useful commands == |
| 89 | ||= Command =||= Description =|| |
| 90 | ||{{{ conda search PACKAGE-NAME }}}|| Searching a software package. || |
| 91 | ||{{{ conda search PACKAGE-NAME=version --info }}}|| Search a software package with a particular version and display the information. || |
| 92 | ||{{{ conda update/upgrade PACKAGE-NAME}}}|| Update a package to the latest version. || |
| 93 | ||{{{ conda uninstall/remove PACKAGE-NAME }}}|| Uninstall or remove a package. || |
| 94 | |
| 95 | == Channels == |
| 96 | Conda channels are sources or repositories from which Conda downloads packages. |
| 97 | - Default Channels: These are pre-configured when you install Conda. They’re hosted by Anaconda, Inc. |
| 98 | - Community Channels: Popular alternatives maintained by the community, such as: {{{conda-forge}}}, {{{bioconda}}}. |
| 99 | |
| 100 | === Configuring CONDA channels === |
| 101 | ||= Command =||= Description =|| |
| 102 | ||{{{ conda config --show channels }}}|| List available channels. || |
| 103 | ||{{{ conda config --prepend channels }}}|| Adding a channel with high priority || |
| 104 | ||{{{ conda config --append channels}}}|| Adding a channel with low priority. || |
| 105 | The configuration settings are stored in the ~/.condarc file. You can modify this file manually to customize Conda’s behavior. |
| 106 | |
| 107 | ==== Some widely used channels ==== |
| 108 | ||= Channel=||= Description =|| |
| 109 | ||conda-forge|| Community supported for general purposes. || |
| 110 | ||bioconda|| Community supported for bioinformatics. || |
| 111 | ||nvidia / cuda|| NVIDIA official support. || |
| 112 | ||pytorch|| Pytorch official support. || |
| 113 | |
| 114 | |
| 115 | ---- |
| 116 | |
| 117 | = Example Installation = |
| 118 | == Installing samtools == |
| 119 | [https://www.htslib.org/ Samtools] is a suite of programs designed for working with high-throughput sequencing data. You can download the source code and build it directly on Cypress, or install it in your virtual environment via the '''bioconda''' channel. |
| 120 | * Create a virtual environment, myenv1: |
| 121 | {{{ |
| 122 | conda create –n myenv1 |
| 123 | }}} |
| 124 | * Activate conda virtual environment: |
| 125 | {{{ |
| 126 | source activate myenv1 |
| 127 | }}} |
| 128 | * Search for the Samtools version via the '''bioconda''' channel: |
| 129 | {{{ |
| 130 | conda search samtools -c bioconda |
| 131 | }}} |
| 132 | * Install version 1.10: |
| 133 | {{{ |
| 134 | conda install samtools=1.10 -c bioconda |
| 135 | }}} |
| 136 | |
| 137 | * Check the version of samtools |
| 138 | {{{ |
| 139 | conda list |
| 140 | }}} |