SoccerNet / sn-gamestate

[CVPRW'24] SoccerNet Game State Reconstruction: End-to-End Athlete Tracking and Identification on a Minimap (CVPR24 - CVSports workshop)
241 stars 50 forks source link

ImportError: Error loading 'tracklab.wrappers.SoccerNetGameState' #8

Closed prsantiago closed 6 months ago

prsantiago commented 6 months ago

When trying to run the baseline I am getting an error where I can´t load the SoccerNetGameState class

i've already run it from the sn-gamestate/, tracklab/ and my soccernet folder and all of them throw the same error.

I installed the packages using pip inside a venv environment, everything got installed smoothly.

legion_5 at pop-os in ~/santiago/predicta/repos/third_party/soccernet/sn-gamestate on main✔ using «env_soccernet»
╰─± python -m tracklab.main -cn soccernet
[2024-05-15 22:27:14,968][__main__][INFO] - Using device: 'cuda'.
Error executing job with overrides: []
Traceback (most recent call last):
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 644, in _locate
    obj = getattr(obj, part)
AttributeError: module 'tracklab' has no attribute 'wrappers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 650, in _locate
    obj = import_module(mod)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/legion_5/santiago/predicta/repos/third_party/soccernet/tracklab/tracklab/wrappers/__init__.py", line 2, in <module>
    from .detect_multiple import *
  File "/home/legion_5/santiago/predicta/repos/third_party/soccernet/tracklab/tracklab/wrappers/detect_multiple/__init__.py", line 3, in <module>
    from .openpifpaf_api import OpenPifPaf
  File "/home/legion_5/santiago/predicta/repos/third_party/soccernet/tracklab/tracklab/wrappers/detect_multiple/openpifpaf_api.py", line 9, in <module>
    import openpifpaf
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/openpifpaf/__init__.py", line 14, in <module>
    from .predictor import Predictor
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/openpifpaf/predictor.py", line 7, in <module>
    from . import datasets, decoder, network, transforms, visualizer
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/openpifpaf/decoder/__init__.py", line 4, in <module>
    from .decoder import Decoder
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/openpifpaf/decoder/decoder.py", line 10, in <module>
    from .. import annotation, visualizer
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/openpifpaf/visualizer/__init__.py", line 4, in <module>
    from .caf import Caf
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/openpifpaf/visualizer/caf.py", line 10, in <module>
    CMAP_BLUES_NAN = copy.copy(matplotlib.cm.get_cmap('Blues'))
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/legion_5/santiago/predicta/repos/third_party/soccernet/tracklab/tracklab/main.py", line 119, in <module>
    main()
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/home/legion_5/santiago/predicta/repos/third_party/soccernet/tracklab/tracklab/main.py", line 28, in main
    tracking_dataset = instantiate(cfg.dataset)
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 226, in instantiate
    return instantiate_node(
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 333, in instantiate_node
    _target_ = _resolve_target(node.get(_Keys.TARGET), full_key)
  File "/home/legion_5/santiago/predicta/repos/third_party/soccernet/tracklab/tracklab/utils/monkeypatch_hydra.py", line 59, in new_resolve_target
    target = _locate(target)
  File "/home/legion_5/santiago/predicta/venvs/env_soccernet/lib/python3.10/site-packages/hydra/_internal/utils.py", line 658, in _locate
    raise ImportError(
ImportError: Error loading 'tracklab.wrappers.SoccerNetGameState':
AttributeError("module 'matplotlib.cm' has no attribute 'get_cmap'")
victorjoos commented 6 months ago

Hi,

It seems that the latest version of matplotlib has changed the way colormaps are accessed. The easiest fix would be to install matplotlib version 3.8.4 (which is the version I'm currently using).

I'll look into fixing this to support later versions of matplotlib.

prsantiago commented 6 months ago

Thanks, it worked!