Skip to content

Issues with Python 3.10 compatibility #258

@lucachitayat

Description

@lucachitayat

@gguzzy

I first downgraded decorator to decorator<5.0,>=4.0.2 to resolve issues with moviepy and another package I can't recall.

I run into this error during a sample training followed from this article: https://www.datature.io/blog/how-to-perform-action-recogition-on-keypoints-with-stgcnn

I tried downgrading numpy, but a new issue arises in this scenario. I am wondering if there is any additional changes needed for the 3.10 compatibility. Currently trying pyskl.yaml instead to see if I can config this way, which so far seems to be running as intended. I believe there is a few package incompatibilities remaining.

See detailed information below.

##Thank you!

Environment

  • Python: 3.10.9
  • Conda environment: pyskl_310
  • Relevant packages:
    • torchvision: 0.13.1
    • mmcv: (version not specified in traceback)
    • yapf: 0.32.0

Steps to Reproduce

  1. Activate the conda environment: conda activate pyskl_310
  2. Run the training script: python tools/train.py

Expected Behavior

The training script should run without errors.

Actual Behavior

The script fails with a TypeError related to the FormatCode function in mmcv/utils/config.py.

Additional Context

The error seems to be caused by an unexpected keyword argument verify in the FormatCode function call.

Suggested Fix

Please provide guidance on how to resolve this issue. Should I update or modify any specific package or function?

Thank you!

(pyskl_310) lchit@LUCA-PC:~/action-recog/pyskl$ bash tools/dist_train.sh configs/j.py 1 --validate --test-last --test-best

  • CONFIG=configs/j.py

  • GPUS=1
    ++ dirname tools/dist_train.sh

  • MKL_SERVICE_FORCE_INTEL=1
    ++ dirname tools/dist_train.sh

  • PYTHONPATH=tools/..:

  • python -m torch.distributed.launch --nproc_per_node=1 --master_port=21820 tools/train.py configs/j.py --launcher pytorch --validate --test-last --test-best
    /home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/launch.py:178: FutureWarning: The module torch.distributed.launch is deprecated
    and will be removed in future. Use torchrun.
    Note that --use_env is set by default in torchrun.
    If your script expects --local_rank argument to be set, please
    change it to read from os.environ['LOCAL_RANK'] instead. See
    https://pytorch.org/docs/stable/distributed.html#launch-utility for
    further instructions

    warnings.warn(
    Traceback (most recent call last):
    File "/home/lchit/action-recog/pyskl/tools/train.py", line 16, in
    from pyskl.apis import init_random_seed, train_model
    File "/home/lchit/action-recog/pyskl/pyskl/apis/init.py", line 4, in
    from .inference import inference_recognizer, init_recognizer
    File "/home/lchit/action-recog/pyskl/pyskl/apis/inference.py", line 14, in
    from pyskl.datasets.pipelines import Compose
    File "/home/lchit/action-recog/pyskl/pyskl/datasets/init.py", line 2, in
    from .base import BaseDataset
    File "/home/lchit/action-recog/pyskl/pyskl/datasets/base.py", line 16, in
    from .pipelines import Compose
    File "/home/lchit/action-recog/pyskl/pyskl/datasets/pipelines/init.py", line 7, in
    from .multi_modality import * # noqa: F401, F403
    File "/home/lchit/action-recog/pyskl/pyskl/datasets/pipelines/multi_modality.py", line 6, in
    from .pose_related import PoseDecode
    File "/home/lchit/action-recog/pyskl/pyskl/datasets/pipelines/pose_related.py", line 3, in
    from scipy.stats import mode as get_mode
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/stats/init.py", line 624, in
    from ._stats_py import *
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/stats/_stats_py.py", line 39, in
    from scipy.spatial import distance_matrix
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/spatial/init.py", line 116, in
    from ._geometric_slerp import geometric_slerp
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/spatial/_geometric_slerp.py", line 7, in
    from scipy.spatial.distance import euclidean
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/spatial/distance.py", line 121, in
    from ..special import rel_entr
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/special/init.py", line 826, in
    from . import _basic
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/special/_basic.py", line 22, in
    from ._multiufuncs import (assoc_legendre_p_all,
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/special/_multiufuncs.py", line 142, in
    sph_legendre_p = MultiUFunc(
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/scipy/special/_multiufuncs.py", line 41, in init
    raise ValueError("All ufuncs must have type numpy.ufunc."
    ValueError: All ufuncs must have type numpy.ufunc. Received (<ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>)
    ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 37345) of binary: /home/lchit/miniconda3/envs/pyskl_310/bin/python
    Traceback (most recent call last):
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/launch.py", line 193, in
    main()
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/launch.py", line 189, in main
    launch(args)
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/launch.py", line 174, in launch
    run(args)
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/run.py", line 752, in run
    elastic_launch(
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 131, in call
    return launch_agent(self._config, self._entrypoint, list(args))
    File "/home/lchit/miniconda3/envs/pyskl_310/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
    raise ChildFailedError(
    torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
    ============================================================
    tools/train.py FAILED


Failures:
<NO_OTHER_FAILURES>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions