Products Resources Support About Us

Managing Python packages for UV


I’m preparing to create our first Python subroutine for a UV BASIC program and want to make use of this package that’s not currently installed:

We’re on RedHat 7 and the native OS Python is version 2. What would be the appropriate method of installing new packages specifically for UV’s Python 3? I found a relevant StackExchange post on dealing with packages for multiple Python versions on the same machine, but I don’t know if the package target install location will be correct for UV’s custom setup:

Based on the accepted answer there, I think something like this might work:

/usr/uv/python/bin/python3 -m pip install dicttoxml

but I don’t know if that will result in the package being installed to /usr/uv/python/lib/python3.4, if there’s a way to insure it goes there, or if packages installed there would get wiped out by an upgrade. Is there a recommended way of managing packages for UV?


As long as your PATH environment variable is set to use the pip from the Python used with UniVerse, it should work ok.

As with any Python Environment, managing your Python code, UniVerse has similar challenges. At a minimum, I would recommend that you store any code you write in a limited number of directories, and make sure that the path to the code is in a .pth file.


Thanks, Mike, this was kind of urgent so I ended up opening a support case for it last week. Christian from support verified the pip command worked as intended by trying it out in a test environment. He also suggested I do it via a script that could be rerun after a UV upgrade in case the UV Python version changes and breaks compatibility. I’m keeping any modules I add on in a text file in the same directory where I’m keeping the UV Python code and looping through them in an install/reinstall script. It added the new module to the UV site-packages directory here:


Here’s the script in case someone else has need for it:


JAH - install/reinstall all custom UV Python modules 10-05-18

UVHOME=cat /.uvhome

while read MODULE
$UV_PY -m pip install --upgrade --no-deps --force-reinstall $MODULE
done < <(cat $MOMTEX_MODULES)


Looks like the forum comment formatting messed with the contents of the script, but the only critical thing it messed up is removing the back quotes around “cat /.uvhome”