diff --git a/Python/QA-003-Conda-Environment.ipynb b/Python/QA-003-Conda-Environment.ipynb index cc8118bf5dfbf6a202ef42fda552a6400323f04d..ecd58457d91efc495fa686b4349d003c753bc96b 100644 --- a/Python/QA-003-Conda-Environment.ipynb +++ b/Python/QA-003-Conda-Environment.ipynb @@ -259,14 +259,38 @@ "will edit your `.bashrc` and that is not nice, especially when you might move to another module. \n", "**Therefore this is not recommended to do.**\n", "\n", - "In order to use your environment in a shell script or on a slurm job, try the following:\n", + "This script is used by `conda init bash` to set the configuration, we simply source (load) it and get the same functionality as we would be using `conda init bash`. **(Do not use `conda init bash`)**\n", "\n", - "Load the shell setup script located in the conda source tree (`${CONDA_ROOT}/etc/profile.d/conda.sh`) and activate your environment:\n", "```bash\n", - "# Load from the current conda module the BASH functionality (as in activate)\n", - "source $(which conda)/../etc/profile.d/conda.sh\n", + "source $(dirname $(which conda))/../etc/profile.d/conda.sh\n", "# now activating the environment works\n", "conda activate myenv\n", + "```\n", + "\n", + "#### bash conda_activate function\n", + "optionaly you can add this bash function to your `.bashrc` for convenience:\n", + "\n", + "```bash\n", + "conda_activate(){\n", + " if ! command -v conda &> /dev/null; then\n", + " echo \"Load ana/miniconda module first\"\n", + " else\n", + " if [ $# -ne 1 ]; then\n", + " echo \"usage: conda_activate [env-name]\"\n", + " \n", + " else\n", + " source $(dirname $(which conda))/../etc/profile.d/conda.sh\n", + " conda activate $1\n", + " fi\n", + " fi\n", + "}\n", + "```\n", + "\n", + "After your `.bashrc` has been loaded (e.g. logout/login again) you should be able to use\n", + "\n", + "```bash\n", + "module load anaconda3\n", + "conda_activate myenv\n", "```" ] }, diff --git a/Python/Your-First-Notebook-onJet_v2.ipynb b/Python/Your-First-Notebook-onJet_v2.ipynb index 5d3796666b3481e0df0f23bda55924264eaee227..3105d22615f1263039374d28e19fd20db04c683c 100644 --- a/Python/Your-First-Notebook-onJet_v2.ipynb +++ b/Python/Your-First-Notebook-onJet_v2.ipynb @@ -575,13 +575,36 @@ "\n", "Hint: Checkout the guides on [Gitlab](https://gitlab.phaidra.org/imgw/computer-resources/-/blob/master/Python/QA-003-Conda-Environment.ipynb#Activate-your-conda-environment)\n", "\n", - "### Load from the current conda module the BASH functionality (as in activate)\n", + "### Load bash conda configuration\n", + "This script is used by `conda init bash` to set the configuration, we simply source (load) it and get the same functionality as we would be using `conda init bash`. **(Do not use `conda init bash`)**\n", "\n", - "```sh\n", - "source $(which conda)/../etc/profile.d/conda.sh\n", + "```bash\n", + "source $(dirname $(which conda))/../etc/profile.d/conda.sh\n", "# now activating the environment works\n", "conda activate myenv\n", "```\n", + "optionaly you can add this bash function to your `.bashrc` for convenience:\n", + "```bash\n", + "conda_activate(){\n", + " if ! command -v conda &> /dev/null; then\n", + " echo \"Load ana/miniconda module first\"\n", + " else\n", + " if [ $# -ne 1 ]; then\n", + " echo \"usage: conda_activate [env-name]\"\n", + " \n", + " else\n", + " source $(dirname $(which conda))/../etc/profile.d/conda.sh\n", + " conda activate $1\n", + " fi\n", + " fi\n", + "}\n", + "```\n", + "After your `.bashrc` has been loaded (e.g. logout/login again) you should be able to use\n", + "\n", + "```bash\n", + "module load anaconda3\n", + "conda_activate myenv\n", + "```\n", "\n", "### Activate your kernel in your notebooks\n", "\n",