The problem
I've had other validation errors in the past because python's packaging dropped support for "legacy" version numbers. To fix this it should be possible to downgrade packaging, if it's your own code that fails installing packaging-legacy could also be an option.
However, this time I was installing some third party application. So I quickly edited the version module to remove the invalid part of the version number.
class Version(_BaseVersion):
_regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
def __init__(self, version: str) -> None:
# Validate the version and parse it into pieces
match = self._regex.search(version)
if not match:
# raise InvalidVersion(f"Invalid version: '{version}'")
version = version.replace("bad_part", "")
match = self._regex.search(version)
if not match:
raise InvalidVersion(f"Invalid version: '{version}'")
Updating the Version class like this could help you too, the version.py file should be in the traceback. It's not a good or permanent solution though, you should probably report bugs upstream, but projects affected by this might not be well maintained.
0 comments
Reply