meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
general:computerenvironment:conda [2023/10/16 09:06] – [Setting up Mamba] felixgeneral:computerenvironment:conda [2024/04/15 12:45] (current) freya
Line 8: Line 8:
 {{  :general:computerenvironment:images:anacondacloud_logo_v_green.png?400  }} {{  :general:computerenvironment:images:anacondacloud_logo_v_green.png?400  }}
 Whenever possible, we will use the [[https://conda.io/docs/index.html|conda package manager]] to install the software we need for the individual analysis steps. The main advantage of this package manager is that it not only installs the program you wish to use, but also all the dependencies you are often not aware of. The conda package manager, which can be easily [[https://www.anaconda.com/download/#macos|installed on your system]] provides access to the [[https://anaconda.org/|Anaconda cloud]]. Using the conda package manager is considerably straightforward and we will guide you through the first steps. However, reading the [[https://conda.io/docs/index.html|documentation]] and using [[https://kapeli.com/cheat_sheets/Conda.docset/Contents/Resources/Documents/index|cheat sheets]] can certainly not harm. Sometimes, it may also help to take a look at the [[https://docs.anaconda.com/anaconda/reference/glossary/|Anaconda glossary]] to get the meaning behind some of the terms used in the context of conda. Whenever possible, we will use the [[https://conda.io/docs/index.html|conda package manager]] to install the software we need for the individual analysis steps. The main advantage of this package manager is that it not only installs the program you wish to use, but also all the dependencies you are often not aware of. The conda package manager, which can be easily [[https://www.anaconda.com/download/#macos|installed on your system]] provides access to the [[https://anaconda.org/|Anaconda cloud]]. Using the conda package manager is considerably straightforward and we will guide you through the first steps. However, reading the [[https://conda.io/docs/index.html|documentation]] and using [[https://kapeli.com/cheat_sheets/Conda.docset/Contents/Resources/Documents/index|cheat sheets]] can certainly not harm. Sometimes, it may also help to take a look at the [[https://docs.anaconda.com/anaconda/reference/glossary/|Anaconda glossary]] to get the meaning behind some of the terms used in the context of conda.
 +
 +<WRAP important>
 +We will be using **Miniconda** in the course, this is sufficient for our purposes
 +</WRAP>
  
  
Line 14: Line 18:
 The standard installation of Anaconda becomes considerably slow after a couple of different environments have been set up. We therefore recommend using [[https://mamba.readthedocs.io/en/latest/index.html|Mamba]] which is much faster than Anaconda but otherwise behaves just as Anaconda does. In fact, Mamba is build upon Anaconda so installing Mamba will also install a bare bones version of Anaconda.  The standard installation of Anaconda becomes considerably slow after a couple of different environments have been set up. We therefore recommend using [[https://mamba.readthedocs.io/en/latest/index.html|Mamba]] which is much faster than Anaconda but otherwise behaves just as Anaconda does. In fact, Mamba is build upon Anaconda so installing Mamba will also install a bare bones version of Anaconda. 
  
-After installing mamba, you can replace the ''conda'' command you use for creating environments and installing packages with ''mamba'' to drastically improve speed. +After installing mamba, you can replace the ''conda'' command you use for creating environments and installing packages with ''mamba'' to drastically improve speed. Throughout this wiki, the ''conda'' and ''mamba'' commands will be used interchangeably. You are free to use either one, but ''mamba'' will be faster most of the time
  
  
Line 20: Line 24:
  
   * You can follow the installation guide on the official [[https://mamba.readthedocs.io/en/latest/mamba-installation.html#mamba-install|Mamba documentation page]] or refer to the steps below   * You can follow the installation guide on the official [[https://mamba.readthedocs.io/en/latest/mamba-installation.html#mamba-install|Mamba documentation page]] or refer to the steps below
-  - Download the latest ''x86_64 Linux'' installer from the [[https://github.com/conda-forge/miniforge#mambaforge|miniforge GitHub page]]<WRAP><code>wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh ~/Downloads</code></WRAP>+  - Download the latest ''x86_64 Linux'' installer from the [[https://github.com/conda-forge/miniforge#mambaforge|miniforge GitHub page]]<WRAP><code>wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh</code></WRAP>
     - Start the installation by typing<WRAP>     - Start the installation by typing<WRAP>
 <code> <code>
 bash Miniforge3-Linux-x86_64.sh bash Miniforge3-Linux-x86_64.sh
-</code><wrap important></wrap>Replace the file name in the above example command with the actual name of the file you just downloaded</WRAP>+</code>
     - The installation process will ask you to read and agree to the license agreement. Press ENTER to see the agreement, then scroll down. At the end you can agree to them by typing **yes**. When asked in which location Anaconda should be installed you can just press ENTER to accept the default location (e.g. /home/your_name/anaconda3).     - The installation process will ask you to read and agree to the license agreement. Press ENTER to see the agreement, then scroll down. At the end you can agree to them by typing **yes**. When asked in which location Anaconda should be installed you can just press ENTER to accept the default location (e.g. /home/your_name/anaconda3).
     - Towards the end of the installation, the installer will ask you:<code>Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no]</code>Answer with:<code>yes</code> This directly activates conda's base environment whenever you open a terminal.     - Towards the end of the installation, the installer will ask you:<code>Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no]</code>Answer with:<code>yes</code> This directly activates conda's base environment whenever you open a terminal.
Line 32: Line 36:
     - Check if the set up was successful:     - Check if the set up was successful:
       - In the new terminal that you have just opened, it should say something like: <code>(base) francisca@workstation1:~$</code> This "(base)" indicates the base conda environment is activated. Now type:<code>conda -h</code>This should print some basic help to your terminal. If all is good, proceed to the next step.       - In the new terminal that you have just opened, it should say something like: <code>(base) francisca@workstation1:~$</code> This "(base)" indicates the base conda environment is activated. Now type:<code>conda -h</code>This should print some basic help to your terminal. If all is good, proceed to the next step.
-  - **Creating a Conda environment.** We will now create a [[https://conda.io/docs/user-guide/tasks/manage-environments.html|working environment]] for your analyses. This step is optional, but it has the advantage of keeping software that you installed via the package manager together in one spot((There is a sweet spot about the package manager, which you should be aware of. Each time you install a program, conda will ask you if it is ok to install, update, or sometimes downgrade a number of packages. This can lead to almost unforeseeable incompatibilities between different programs installed in the same environment. To avoid this, some people go as far as creating for each program its own environment...)). Moreover, it helps to have different - and even conflicting - set-ups at the same time on your computer. For example, you can have two environments using different versions of [[wp>Python_(programming_language)|python]], and you can easily switch between them. +  - **Creating a Conda environment.** We will now create a [[https://conda.io/docs/user-guide/tasks/manage-environments.html|working environment]] for your analyses. It has the advantage of keeping software that you installed via the package manager together in one spot((There is a sweet spot about the package manager, which you should be aware of. Each time you install a program, conda will ask you if it is ok to install, update, or sometimes downgrade a number of packages. This can lead to almost unforeseeable incompatibilities between different programs installed in the same environment. To avoid this, some people go as far as creating for each program its own environment...)). Moreover, it helps to have different - and even conflicting - set-ups at the same time on your computer. For example, you can have two environments using different versions of [[wp>Python_(programming_language)|python]], and you can easily switch between them. 
-    - To create a working environment named **//compgen//**  with python 3.8((In case you require both python 2.7 and 3.8, then simply generate an environment for each python version)), type<code>+    - To create a working environment named **//compgen//**  with python 3.9((In case you require both python 2.7 and 3.9, then simply generate an environment for each python version)), type<code>
 mamba create --name compgen python=3.9</code>  mamba create --name compgen python=3.9</code> 
     - To activate the environment, type<code>conda activate compgen</code>     - To activate the environment, type<code>conda activate compgen</code>
Line 51: Line 55:
 channel URLs : https://conda.anaconda.org/conda-forge/osx-64</code> channel URLs : https://conda.anaconda.org/conda-forge/osx-64</code>
   - If the installation was successful, you can ask for further help with the individual commands,such as, //e.g. //**//install//**  , **//update//**  , **//remove//**  by typing<code>conda install --help</code>   - If the installation was successful, you can ask for further help with the individual commands,such as, //e.g. //**//install//**  , **//update//**  , **//remove//**  by typing<code>conda install --help</code>
-  - You are now ready to install any software that is distributed via the [[http://conda.io/docs/index.html|conda package manager]] using the following command<code>mamba install -c CHANNELNAME PACKAGENAME</code>+  - <wrap important>Do not install anything in your ''base'' environment. This might cause Mamba/Anaconda to malfunction. Always create a new environment and install packages in there</wrap> 
 +  - You are now ready to install any software that is distributed via the [[http://conda.io/docs/index.html|conda package manager]] using the following command<code>mamba install CHANNELNAME::PACKAGENAME</code>
   - The software packages are distributed via different channels. We will mainly use the channels [[https://anaconda.org/bioconda|bioconda]] and [[https://anaconda.org/conda-forge|conda-forge]].   - The software packages are distributed via different channels. We will mainly use the channels [[https://anaconda.org/bioconda|bioconda]] and [[https://anaconda.org/conda-forge|conda-forge]].
   - To simplify your life, it might be a good idea to add frequently used channels to a list of channels where [[http://conda.io/docs/index.html|conda]] searches for your package by default. Use the following syntax to add the channels [[https://bioconda.github.io|bioconda]] and [[https://bioconda.github.io|conda-forge]] to your default channel list<code>   - To simplify your life, it might be a good idea to add frequently used channels to a list of channels where [[http://conda.io/docs/index.html|conda]] searches for your package by default. Use the following syntax to add the channels [[https://bioconda.github.io|bioconda]] and [[https://bioconda.github.io|conda-forge]] to your default channel list<code>