Commit 4c168ea3 authored by Sören Wacker's avatar Sören Wacker
Browse files

add Python environments tutorial covering UV, Pixi, and Micromamba

parent b3a68e1f
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -135,6 +135,53 @@ $ source /tudelft.net/staff-umbrella/<project>/venvs/myenv/bin/activate
$ pip install transformers
```

## Option 5: Micromamba (global conda environments)

[Micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) is a lightweight conda implementation. Use it when you need traditional conda environments shared across projects.

### Install Micromamba

```shell-session
$ "${SHELL}" <(curl -L micro.mamba.pm/install.sh)
```

Follow the prompts. When asked for install location, use your project storage:
```
/tudelft.net/staff-umbrella/<project>/micromamba
```

### Create and use environments

```shell-session
$ micromamba create -n myenv python=3.11 pytorch numpy -c conda-forge -c pytorch
$ micromamba activate myenv

$ python -c "import torch; print(torch.__version__)"
```

### Use in batch scripts

```bash
#!/bin/bash
#SBATCH --account=<your-account>
#SBATCH --partition=all
#SBATCH --gres=gpu:1

module purge
module load 2025/gpu cuda/12.9

eval "$(micromamba shell hook --shell bash)"
micromamba activate myenv

srun python train.py
```

{{% alert title="When to use which tool" color="info" %}}
- **UV**: Best for most projects. Fast, lockfiles, reproducible.
- **Pixi**: When you need conda-forge packages in a project.
- **Micromamba**: When you need shared environments across projects.
{{% /alert %}}

## Next steps

- See [Modules](/docs/software/modules/) for available packages
+877 −0

File added.

Preview size limit exceeded, changes collapsed.