MiniForge Python

MiniForge Python

Installing your own python distribution is straightforward. Follow these steps:

Warning! If you choose to install and use your own Python distribution, please ensure that your ~/.bashrc is free from references to any other old/existing conda-like installation. E.g., you should first remove lines from your ~/.bashrc like:

... ... # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/YOUR_USERNAME/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/YOUR_USERNAME/miniconda3/etc/profile.d/conda.sh" ]; then . "/home/YOUR_USERNAME/miniconda3/etc/profile.d/conda.sh" else export PATH="/home/YOUR_USERNAME/miniconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< ... ...

Once removed, the MiniForge installation that results from following the steps below will overwrite your ~/.bashrc with the new initialisation.

Installing MiniForge

  1. Visit GitHub - conda-forge/miniforge: A conda-forge distribution.

  2. Navigate to the latest release

  3. Copy the link address of the latest x86 installation script (e.g., https://github.com/conda-forge/miniforge/releases/download/25.11.0-0/Miniforge3-25.11.0-0-Linux-x86_64.sh )

  4. SSH to a login node using your NHR@ZIB user account

  5. Download the installation script: wget YOUR_PASTED_LINK_FROM_STEP_3

  6. Run the script: bash YOUR_DOWNLOADED_INSTALL_SCRIPT_FROM_STEP_5

  7. Follow the installation instructions, choosing where you would like the MiniForge python distribution to be installed (it is recommended to install your own distributions in SCRATCH - e.g., /scratch/usr/$(whoami)/miniforge3- as the HOME directory can easily fill up do to package storage)

  8. You will be prompted about automatic initialisation:

    Do you wish to update your shell profile to automatically initialize conda? This will activate conda on startup and change the command prompt when activated. If you'd prefer that conda's base environment not be activated on startup, run the following command when conda is activated: conda config --set auto_activate_base false Note: You can undo this later by running `conda init --reverse $SHELL` Proceed with initialization? [yes|no] [no„] >>>

If you select yes, an initialisation block will be appended to your ~/.bashrc, such that every time you open a new shell, the shell will be aware of this new MiniForge installation. If your ~/.bashrc is free of any old conda-like initialisation blocks, go ahead and enter yes. Otherwise, you may wish to enter noand manage multiple Python installations manually to avoid clashes.

  1. Run source ~/.bashrc to finish the initialisation

Creating a new Environment

  1. Create a new (e.g., python 3.12) environment using mamba create -n “my_environment” python=3.12

  2. Activate that environment using mamba activate my_environment

 

From here, you can install python packages to that environment using mamba and/or run Python programs. Recommendation: preferably install packages using mamba only instead of conda (slower) or pip (slower, potential dependency conflicts). Avoid: mixing different package managers.