Found workaround.
Hi there, we came across this issue during an install of a new Ubuntu.
The error is from the way the installer tries to parse the version (an int) from the driver name. The code assumes the version is the last part of the driver name, which in most cases is fine e.g. nvidia-driver-520. In my scenario the driver name was nvidia-driver-520-open and the code ends up trying to parse open as an int and fails, throwing the undefined error a few lines later as version failed to be parsed.
Solution:
This will only work if you have access to /usr/lib/python3/dist-packages/UbuntuDrivers and have edit permission.
offending line: /usr/lib/python3/dist-packages/UbuntuDrivers/detect.py:835
find following line:
version = int(package_name.split('-')[-1])
modify to:
version = int(package_name.split('-')[2])
Note this is assuming the version is the 3rd word in the driver name split by ‘-’
Understandably when trying to parse values from names only these issues can happen from time to time.
A long-term fix would need the insight of the naming conventions of current and for future driver package names.