From 58bf2ea2f442364e25da99a80dca35b547b24b0d Mon Sep 17 00:00:00 2001 From: Thomas Sell Date: Thu, 22 Aug 2024 14:29:27 +0200 Subject: [PATCH] re-do conda migration guide --- bih-cluster/docs/storage/migration-faq.md | 61 ++++++++++------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/bih-cluster/docs/storage/migration-faq.md b/bih-cluster/docs/storage/migration-faq.md index f1f3aa4f3..795dd7754 100644 --- a/bih-cluster/docs/storage/migration-faq.md +++ b/bih-cluster/docs/storage/migration-faq.md @@ -43,42 +43,6 @@ $ rm -r $SOURCE Its better to use a trailing slash which matches “All files in this folder”. ## Moving user work folders -### Conda environments -Conda installations tend not to react well to moving their main folder from its original location. -There are numerous ways around this problem which are described [here](https://www.anaconda.com/blog/moving-conda-environments). - -A simple solution we can recommend is this: - -1. Before the move, activate your old conda installation like so: -```sh -$ source /fast/work/users/$USER/{your_conda_folder}/bin/activate -``` - -2. Export all environments with this bash script: -```sh -#!/bin/bash -for env in $(ls $(conda info --base)/envs/) -do - conda env export -n $env -f $env.yml -done - -``` - If you run into errors it might be better to use `conda env export -n $env --no-builds -f $env.yaml`. - In case your old conda installation cannot be activated anymore, you can also use your new conda to do the export - by specifying a full path like so: `conda env export -p /fast/work/user/$USER/miniconda/envs/ -f .yaml`. - -3. Install a fresh version of conda or mamba in your new work folder. - Don't forget to turn off automatic base environment activation for less delay during login and reduced strain on the login nodes. -```sh -$ conda init -$ conda config --set auto_activate_base false -``` - -4. Re-create your old environments from the yaml files: -```sh -$ conda env create -f {environment.yml} -``` - ### Work data 1. All files within your own work directory can be transferred as follows. Please replace parts in curly braces with your cluster user name. @@ -104,3 +68,28 @@ $ rsync -ahP --stats --remove-source-files --dry-run $SOURCE $TARGET $ find $SOURCE -type f | wc -l 0 ``` + +### Conda environments +Conda installations tend not to react well to moving their main folder from its original location. +There are numerous ways around this problem which are described [here](https://www.anaconda.com/blog/moving-conda-environments). + +A simple solution we can recommend is this: + +1. Install a fresh version of conda or mamba in your new work folder. + Don't forget to first remove the conda init block in `~/.bashrc`. +```sh +$ nano ~/.bashrc +$ conda init +$ conda config --set auto_activate_base false +``` + +2. You can then use your new conda to export your old environments by specifying a full path like so: +```sh +$ conda env export -p /fast/work/user/$USER/miniconda/envs/ -f .yaml +``` +If you run into errors it might be better to also use the `--no-builds` flag. + +3. Finally re-create your old environments from the yaml files: +```sh +$ conda env create -f {environment.yml} +``` \ No newline at end of file