Using the uv package manager with Python on Phoebe¶
Using the uv Python package manager¶
Install uv¶
Load modules providing MPI, gcc and friends, and our Python we selected arbitrarly
Packages you installed earlier with pip install --user for the same Python version (in
~/.local/lib/python3.12) can interfere with uv environments. Check what is there:
and remove only what you no longer need with python -m pip uninstall <package>.
Install the uv using pip:
that's it :)
Create a uv project¶
This creates pyproject.toml and a few starter files. uv creates the project's virtual
environment in .venv the first time you run or add something.
Run Python in a uv project¶
[jose@login1 example]$ uv run python
Python 3.12.3 (main, Aug 29 2024, 16:11:54) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ruff
>>> import mpi4py
>>> quit()
[jose@login1 example]$ which uv
~/.local/bin/uv
[jose@login1 example]$ uv run which python
/home/jose/example/.venv/bin/python
[jose@login1 example]$ uv run which gcc
/cvmfs/2024a.phoebe.lan/software/GCCcore/13.3.0/bin/gcc
[jose@login1 example]$ uv run which mpirun
/cvmfs/2024a.phoebe.lan/software/OpenMPI/5.0.3-GCC-13.3.0/bin/mpirun
[jose@login1 example]$