The current code works in Linux and Windows:
from slicer.util import pip_install; pip_install('pymedphys')
However that is not the case for MacOS. In case you want to use this cool library that includes gamma comparison among other cool stuffs you need to make:
from slicer.util import pip_install pip_install('dataclasses') pip_install('pymedphys --no-deps')
And voila, it is working!
Example module for gamma comparison here https://github.com/BishopWolf/GammaIndex
Feel free to propose changes