3

I've written an MLflow component to upload & log an artifact from a URL to WandB. I am trying to run the script inside a conda environment but unfortunately I am facing this error

File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\__init__.py", line 38, in <module>
    from wandb import sdk as wandb_sdk
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\sdk\__init__.py", line 12, in <module>
    from .wandb_init import init  # noqa: F401
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\sdk\wandb_init.py", line 29, in <module>
    from .backend.backend import Backend
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\sdk\backend\backend.py", line 18, in <module>
    from ..internal.internal import wandb_internal
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\sdk\internal\internal.py", line 34, in <module>
    from . import sender
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\sdk\internal\sender.py", line 18, in <module>
    from wandb.filesync.dir_watcher import DirWatcher
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\filesync\dir_watcher.py", line 10, in <module>
    wd_polling = util.vendor_import("watchdog.observers.polling")
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\util.py", line 170, in vendor_import
    module = import_module(name)
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\vendor\watchdog\observers\__init__.py", line 92, in <module>
    from .polling import PollingObserver as Observer
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\vendor\watchdog\observers\polling.py", line 43, in <module>
    from watchdog.observers.api import (
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\vendor\watchdog\observers\api.py", line 23, in <module>
    from watchdog.utils.bricks import SkipRepeatsQueue
  File "C:\anaconda\envs\mlflow-4b67c93d2a95df2e00cbf3c9f644d2e3dada00e0\lib\site-packages\wandb\vendor\watchdog\utils\bricks.py", line 175, in <module>
    class OrderedSet(collections.MutableSet):
AttributeError: module 'collections' has no attribute 'MutableSet'
2022/10/09 20:55:53 ERROR mlflow.cli: === Run (ID 'e5ad70e5104e4a50ad3f66a891bdbf81') failed ===

I've installed the WandB==0.13.2 & protobuf==3.20.3 & Mlflow latest version in my environment. I think it's happening because of dependency mismatch but not really sure.

Also, I've added the WandB & Protobuf in my conda.yml file for mlflow component script.

Thanks in advance.

1 Answers1

5

I have this problem when I code with python, in the new version of python collections have no more MutableSet, MutableMapping, etc.. But the module collections.abc have it so if you want you can go like this:

import collections 
import sys
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
    from collections.abc import MutableSet
    collections.MutableSet = collections.abc.MutableSet
else: 
    from collections import MutableSet

So I think that the version of wandb is maybe not compatible with this version of Python

Source : https://www.datasciencelearner.com/attributeerror-module-collections-has-no-attribute-mutablemapping/

Normally they fix it.. : https://github.com/wandb/wandb/issues/1503

PascalVKooten
  • 20,643
  • 17
  • 103
  • 160