Uprgrading Python in UniVerse or UniData
January 31, 2023
Starting at UniVerse 12.2.1 and UniData 8.2.4, you have additional control over how your Python environment is maintained during an upgrade.
Previously, when you upgraded your Rocket U2 database, a new version of Python replaced the previous version requiring your System Admin/DBA to reinstall needed modules and/or to modify the .pth files (putting them back to the way they were before the upgrade).
Now, during the upgrade you are presented with two questions:
- Do you want to preserve Python .pth files?
- Do you want to preserve Python module files?
If you answer no, (or don’t select the check box on Windows upgrades), the U2 install process will replace the Python version, and you will need to create/modify your .pth files as necessary, and then pip install the modules you are using for the new version of Python. This is helpful when you have been working with Python for a while and would like to start with a clean slate.
If you answer yes to both questions, the environment will be closer to what you had on the previous release. This upgrade will attempt to reinstall the modules that were on the system before the upgrade and put the previous .pth files in the new Python environment.
Please note, there may be times where the version of the module you had in Python will not work with the new version of Python. We recommend that before the upgrade, you make a copy of what is already installed in Python. You can accomplish this using the ‘pip freeze’ command at the OS prompt.
C:\U2\ud82\Python>Scripts\pip.exe freeze numpy==1.23.0 pycparser==2.21 rabbitmq==0.2.0 uopy==1.2.0
The previous command creates a list of what is installed. Note that it may not be the latest version of the Python module found at pypi.org. To check if there is a newer version of any of the modules, you can use pip and try to install a version that does not exist.
For example -
C:\U2\ud82\Python>python.exe -m pip install uopy== ERROR: Could not find a version that satisfies the requirement uopy== (from versions: 1.1.0, 1.1.1, 1.2.0) ERROR: No matching distribution found for uopy==
After finding the latest version of the Python module, you can install it by using the specific version number, or by executing the pip with the upgrade option.
For example -
python -m pip install uopy==1.2.0 or python -m pip install --upgrade uopy
Note that in the above examples, I used ‘python -m’ in front of my pip command to ensure the correct version of Python is getting updated.