-
-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Reposting #340 (comment) as an issue.
I'm observing importlib_metadata.packages_distributions()
throw the following error:
File "/opt/mlflow/mlflow/utils/requirements_utils.py", line 129, in <module>
_MODULE_TO_PACKAGES = importlib_metadata.packages_distributions()
File "/miniconda/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 1016, in packages_distributions
for pkg in _top_level_declared(dist) or _top_level_inferred(dist):
File "/miniconda/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 1026, in _top_level_inferred
return {
https://github.com/mlflow/mlflow/runs/3428616955#step:5:7078
It looks like the line 1028 in _top_level_inferred
tries to iterate on dist.files
that can be None and then throws the error above:
importlib_metadata/importlib_metadata/__init__.py
Lines 1025 to 1030 in 15df009
def _top_level_inferred(dist): | |
return { | |
f.parts[0] if len(f.parts) > 1 else f.with_suffix('').name | |
for f in dist.files | |
if f.suffix == ".py" | |
} |
https://docs.python.org/3/library/importlib.metadata.html#distribution-files says:
In the case where the metadata file listing files (RECORD or SOURCES.txt) is missing, files() will return None. The caller may wish to wrap calls to files() in always_iterable or otherwise guard against this condition if the target distribution is not known to have the metadata present.