diff --git a/admin-guide/configuration/software/conda.md b/admin-guide/configuration/software/conda.md index c2995095..d897b66e 100644 --- a/admin-guide/configuration/software/conda.md +++ b/admin-guide/configuration/software/conda.md @@ -1,107 +1,50 @@ -# Conda / Anaconda +# Conda / Miniforge -Conda / Anaconda (https://conda.org) is a package manager that can be used to easily create tailored Python environments without having required C/... binaries of some packages installed on the local system. (i.e. conda will take care that required binaries are installed into the environment) +Conda/Miniforge (https://github.com/conda-forge/miniforge) is a package manager that can be used to easily create tailored Python environments without having required C/... binaries of some packages installed on the local system. (i.e. conda will take care that required binaries are installed into the environment) ```{warning} Due to certain license restrictions the usage of Anaconda at PSI is not allowed without obtaining a professional license from Anaconda.com! - -However the usage of the command `conda` and/or of packages from conda-forge is still possible - see below ... ``` -This guide explains how to install and configure conda in accordance to the Anaconda.com license terms. +This guide explains how to install and configure miniforge to not violate anaconda.com licensing terms. + +Also see: https://www.psi.ch/en/awi/infos ## Installation -On a standard Linux system the conda package can be simply installed via a: +On a standard Linux system the miniforge can be simply installed in your home as follows: -``` -yum install conda -``` - -To instruct puppet to install the package you can have following hiera config: - -```yaml -base::pkg_group::extra: - - 'conda' - -base::package_groups: - - 'extra' -``` - -For new installations, it is easiest to use __miniforge__, which is miniconda where `defaults` is replaced by `conda-forge` out of the box: - -https://github.com/conda-forge/miniforge - -## Configuration - -You need to **completely** remove the main channel from your personal config, i.e., from `~/.condarc`. - -In the `channels` section, the main channel is usually called `defaults` or given as two URLs: - -- https://repo.anaconda.com/pkgs/main -- https://repo.anaconda.com/pkgs/r - -Instead, you need to insert `conda-forge` into the channel list if it is not already on the list. - -You can use the following command to check if your config is correct: +- Download the miniforge installer: ```bash -conda config --show-sources +curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh ``` -The output should not contain any variant of the main channel! - - -To overwrite the default configuration of conda (which would violate the license because packages would be installed from anaconda.org by default) following config file needs to be deployed in `/etc/conda/condarc.d/base.yml` (or similar): - -```yaml -report_errors: false -channels: -- conda-forge -- nodefaults - -# Show channel URLs when displaying what is going to be downloaded -# and in 'conda list'. The default is False. -show_channel_urls: True -always_copy: true +- Run the Installer: +```bash +bash Miniforge3-Linux-x86_64.sh ``` -To place the file via Puppet/Hiera you can have following configuration: +You need to accept the license and specify your install directory, which, most cases would be ~/miniforge3 -```yaml -files::files: - /etc/conda/condarc.d/base.yml: - content: | - report_errors: false - channels: - - conda-forge - - nodefaults - - # Show channel URLs when displaying what is going to be downloaded - # and in 'conda list'. The default is False. - show_channel_urls: True - always_copy: true -``` - - -To be able to use the `conda` command a user needs to source the command into its current shell. This can be done like this: +At the end you are asked whether you want to modify your shells startup script and activate conda automatically. We recommend to answer that question with NO and not do it. By automatically activating conda you might have very strange side effects! +The promt looks something like this: ```bash -source /opt/conda/etc/profile.d/conda.sh +You can undo this by running `conda init --reverse $SHELL`? [yes|no] +[no] >>> ``` +After the installation is finished you can then activate conda/miniforge manually via -Afterwards conda environments can be created in a license conformed way as documented at https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html +```bash +eval "$(~/mpc/homes/thiele_b~/miniforge3/bin/conda shell.bash hook)" +``` +To make things easier we recommend that you add an alias in your `~/.bashrc` that looks like this (simply add this at the end of the file): -## Usage +```bash +alias load_conda='eval "$(~/miniforge3/bin/conda shell.bash hook)"' +``` -More details on the usage of the `conda` command can be found here: -https://docs.conda.io/projects/conda/en/stable/user-guide/index.html - - -### Important Info -It seems that the `conda list ` command still uses the default channel. However `conda install` seem to respect the config above. - -Probably related to this here: -https://stackoverflow.com/questions/67695893/how-do-i-completely-purge-and-disable-the-default-channel-in-anaconda-and-switch +Then you can activate/load conda by simply typing `load_conda` in your shell/terminal.