You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under certain conditions, the import of packaging.version or setuptools._vendor.packaging.version works fine, and the call to the Version() function within them works fine to return a valid Version() object, but for a stock RHEL8 install using the /usr/bin/python3 default provided by the python36 RPM, the returned object does not include the .major or .minor attributes, leading to an AttributeError being thrown in setup.py when defining the SLURM_VERSION string.
It looks like the root cause is the version of the packaging module - on the faulty instances it's version 16.8 bundled with the python36-3.6.8 RPM, but with version 21.0 in an Anaconda instance I have, and when using the RHEL8 python39 RPM's /usr/bin/python3.9 executable in which packaging is version 20.4, delivers a working result that includes the major, minor, and micro attributes.
Even the python3-packaging RPM on RHEL8, which provides packaging.version, is also version 16.8, and exhibits the same behavior leading to the AttributeError.
Here's how I tweaked the setup.py to work around the problem:
def get_version():
with (TOPDIR / "pyslurm/__version__.py").open() as f:
for line in f.read().splitlines():
if line.startswith("__version__"):
V = Version(line.split('"')[1])
if not hasattr(V, "major") or not hasattr(V, "minor"):
(V.major, V.minor) = V._version.release[0:2]
return V
raise RuntimeError("Cannot get version string.")
Given the PYTHON_MIN_REQUIRED setting of 3.6, it may be worthwhile to modify setup.py accordingly to accommodate the shortcomings of the v16.8 packaging module.
The text was updated successfully, but these errors were encountered:
mvpel
changed the title
Problem in setup.py get_version() - version object is missing .major and .minor attributes
Problem in setup.py get_version() - packaging.version object is missing .major and .minor attributes in earlier versions under Python 3.6
Feb 14, 2024
mvpel
changed the title
Problem in setup.py get_version() - packaging.version object is missing .major and .minor attributes in earlier versions under Python 3.6
Problem in setup.py get_version() - packaging.version object is missing .major and .minor attributes in earlier module versions under Python 3.6
Feb 14, 2024
Details
Issue
Under certain conditions, the import of packaging.version or setuptools._vendor.packaging.version works fine, and the call to the Version() function within them works fine to return a valid Version() object, but for a stock RHEL8 install using the /usr/bin/python3 default provided by the python36 RPM, the returned object does not include the .major or .minor attributes, leading to an AttributeError being thrown in setup.py when defining the SLURM_VERSION string.
It looks like the root cause is the version of the packaging module - on the faulty instances it's version 16.8 bundled with the python36-3.6.8 RPM, but with version 21.0 in an Anaconda instance I have, and when using the RHEL8 python39 RPM's /usr/bin/python3.9 executable in which packaging is version 20.4, delivers a working result that includes the major, minor, and micro attributes.
Even the python3-packaging RPM on RHEL8, which provides packaging.version, is also version 16.8, and exhibits the same behavior leading to the AttributeError.
Here's how I tweaked the setup.py to work around the problem:
Given the PYTHON_MIN_REQUIRED setting of 3.6, it may be worthwhile to modify setup.py accordingly to accommodate the shortcomings of the v16.8 packaging module.
The text was updated successfully, but these errors were encountered: