How to use monailabel with uv on macOS

Create Virtual Environment

uv venv -p 3.12
# Create python3.12 virtual environment

Activate Virtual Environment

source .venv/bin/activate

Install monailabel

uv pip install monailabel

Confirm monailabel Installation Path and Create Symlink

(monai) ww@loaclhost ~/c/monai (main) [255]> uv pip show monailabel
Name: monailabel
Version: 0.8.5
Location: /Users/ww/coding/monai/.venv/lib/python3.12/site-packages

Look inside /Users/ww/coding/monai/.venv/lib/python3.12/site-packages, and finally confirm the path is

/Users/ww/coding/monai/.venv/lib/python3.12/site-packages/monailabel/scripts/monailabel

Create symlink

ln -s /Users/ww/coding/monai/.venv/lib/python3.12/site-packages/monailabel/scripts/monailabel /Users/ww/coding/monai/.venv/bin/monailabel

Use monailabel

Then you can use monailabel by typing it in the terminal

(monai) ww@loaclhost ~/c/monai (main)> monailabel
Using PYTHONPATH=/Users/ww/coding/monai:

usage: monailabel [-h] [-v] {start_server,apps,datasets,plugins} ...

Error

ValueError: Cannot find MONAI Label installed: sample-apps installed directory. Add '--prefix' of installed path.

Not sure how to handle this for now
Just use conda first macos通过conda使用monailabel

More

monailabel official manual https://docs.monai.io/projects/label/en/latest/installation.html