sn-gamestate icon indicating copy to clipboard operation
sn-gamestate copied to clipboard

Pytorch dependency conflicts

Open akweiss opened this issue 8 months ago • 1 comments

Hello! Just wanted to flag some issues that I ran into while trying to install. The dependencies in pyproject.toml force torch==1.13.1 (presumably because this is the torch version that gets the specified versions of mmocr, mmdet and mmcv to all work), but then when running uv run tracklab -cn soccernet, Pytorch is disabled for requiring >= 2.1 somewhere else. Here's the error I got:

Error executing job with overrides: []
Traceback (most recent call last):
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/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/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 650, in _locate
    obj = import_module(mod)
  File "/home/akweiss/.local/share/uv/python/cpython-3.9.23-linux-x86_64-gnu/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/wrappers/__init__.py", line 3, in <module>
    from .eval import *
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/wrappers/eval/__init__.py", line 1, in <module>
    from .posetrack import *
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/wrappers/eval/posetrack/__init__.py", line 1, in <module>
    from .posetrack18_evaluator import PoseTrack18Evaluator
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/wrappers/eval/posetrack/posetrack18_evaluator.py", line 22, in <module>
    from .posetrack21_evaluator import PoseTrack21Evaluator as PTEvaluator
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/wrappers/eval/posetrack/posetrack21_evaluator.py", line 29, in <module>
    from torchmetrics.detection.mean_ap import MeanAveragePrecision
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/torchmetrics/__init__.py", line 14, in <module>
    from torchmetrics import functional  # noqa: E402
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/torchmetrics/functional/__init__.py", line 77, in <module>
    from torchmetrics.functional.text.bleu import bleu_score
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/torchmetrics/functional/text/__init__.py", line 30, in <module>
    from torchmetrics.functional.text.bert import bert_score  # noqa: F401
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/torchmetrics/functional/text/bert.py", line 24, in <module>
    from torchmetrics.functional.text.helper_embedding_metric import (
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/torchmetrics/functional/text/helper_embedding_metric.py", line 26, in <module>
    from transformers import AutoModelForMaskedLM, AutoTokenizer, PreTrainedModel, PreTrainedTokenizerBase
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/transformers/__init__.py", line 27, in <module>
    from . import dependency_versions_check
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/transformers/dependency_versions_check.py", line 57, in <module>
    require_version_core(deps[pkg])
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/transformers/utils/versions.py", line 117, in require_version_core
    return require_version(requirement, hint)
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/transformers/utils/versions.py", line 111, in require_version
    _compare_versions(op, got_ver, want_ver, requirement, pkg, hint)
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/transformers/utils/versions.py", line 44, in _compare_versions
    raise ImportError(
ImportError: huggingface-hub>=0.34.0,<1.0 is required for a normal functioning of this module, but found huggingface-hub==0.30.2.
Try: `pip install transformers -U` or `pip install -e '.[dev]'` if you're working with git main

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

Traceback (most recent call last):
  File "/home/akweiss/sn-gamestate/.venv/bin/tracklab", line 10, in <module>
    sys.exit(main())
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/main.py", line 29, in main
    tracking_dataset = instantiate(cfg.dataset)
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 226, in instantiate
    return instantiate_node(
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 333, in instantiate_node
    _target_ = _resolve_target(node.get(_Keys.TARGET), full_key)
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/tracklab/utils/monkeypatch_hydra.py", line 59, in new_resolve_target
    target = _locate(target)
  File "/home/akweiss/sn-gamestate/.venv/lib/python3.9/site-packages/hydra/_internal/utils.py", line 658, in _locate
    raise ImportError(
ImportError: Error loading 'tracklab.wrappers.SoccerNetGameState':
ImportError("huggingface-hub>=0.34.0,<1.0 is required for a normal functioning of this module, but found huggingface-hub==0.30.2.\nTry: `pip install transformers -U` or `pip install -e '.[dev]'` if you're working with git main") 

I edited the pyproject.toml to require torch >= 2.1 (and huggingface-hub>=0.34.0,<1.0) but then ran into later errors due to torch >= 2.1 being incompatible with mmcv, mmocr, and mmdet.

akweiss avatar Aug 07 '25 16:08 akweiss

Solution to that - https://github.com/SoccerNet/sn-gamestate/issues/31

yashb042 avatar Aug 12 '25 07:08 yashb042