open-mmlab / mmaction2

OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark
https://mmaction2.readthedocs.io
Apache License 2.0
4.31k stars 1.25k forks source link

[Bug] ModuleNotFoundError: No module named 'mmaction.models.localizers.drn' #2714

Open dummyindex opened 1 year ago

dummyindex commented 1 year ago

Branch

main branch (1.x version, such as v1.0.0, or dev-1.x branch)

Prerequisite

Environment

Fresh Anaconda output of pip freeze | grep mm (filtered other packages with mm substring

mmaction2==1.2.0
mmcv==2.1.0
mmdet==3.2.0
mmengine==0.9.0
mmpose==1.2.0

Describe the bug

An import failure bug. DRN is missing.

Reproduces the problem - code sample

installed on 10/18/2023 via

pip install -U openmim
mim install mmengine
mim install mmcv
mim install mmdet
mim install mmpose
pip install mmaction2
Traceback (most recent call last):
  File "/home/someUser/livecellx/notebooks/scripts/mmdetection_classify/train.py", line 124, in <module>
    main()
  File "/home/someUser/livecellx/notebooks/scripts/mmdetection_classify/train.py", line 117, in main
    runner = Runner.from_cfg(cfg)
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/runner/runner.py", line 462, in from_cfg
    runner = cls(
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/runner/runner.py", line 429, in __init__
    self.model = self.build_model(model)
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/runner/runner.py", line 836, in build_model
    model = MODELS.build(model)
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/registry/registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 232, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 98, in build_from_cfg
    obj_cls = registry.get(obj_type)
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/registry/registry.py", line 451, in get
    self.import_from_location()
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmengine/registry/registry.py", line 376, in import_from_location
    import_module(loc)
  File "/home/someUser/anaconda3/envs/livecellx/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/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmaction/models/__init__.py", line 6, in <module>
    from .localizers import *  # noqa: F401,F403
  File "/home/someUser/anaconda3/envs/livecellx/lib/python3.9/site-packages/mmaction/models/localizers/__init__.py", line 4, in <module>
    from .drn.drn import DRN
ModuleNotFoundError: No module named 'mmaction.models.localizers.drn'

Reproduces the problem - command or script

No response

Reproduces the problem - error message

No response

Additional information

A temporary solution: comment out the DRN part if DRN is not required :).

# Copyright (c) OpenMMLab. All rights reserved.
from .bmn import BMN
from .bsn import PEM, TEM
# from .drn.drn import DRN
from .tcanet import TCANet

__all__ = ['TEM', 'PEM', 'BMN', 'TCANet'] # , 'DRN']
wsascha commented 1 year ago

Can confirm.

My guess it's a missing __init__.py in mmaction/models/localizers/drn.

15598003953 commented 1 year ago

I had the same problem as you, did you solve it please?

15598003953 commented 1 year ago

.\Anaconda3\envs\mmact2\lib\site-packages\mmaction2-1.2.0-py3.8.egg\mmaction\models\localizers\ I found no drn file in this directory, it should need to be added, did you find this file please?

guidovanschie-nedap commented 1 year ago

Somehow, this directory: https://github.com/open-mmlab/mmaction2/tree/4d6c93474730cad2f25e51109adcf96824efc7a3/mmaction/models/localizers/drn did not end up in the pypi package: https://pypi.org/project/mmaction2/1.2.0/

You can fix this temporarily by copying the dir into your installed mmaction2 package (......./site-packages/mmaction/models/localizers/)

shekarneo commented 11 months ago

Any fix for this issue?

farhadi76m commented 9 months ago

I fixed it manually by copying drn folder to AppData\Local\Programs\Python\Python39\Lib\site-packages\mmaction\models\localizers

Kataglyphis commented 8 months ago

It also occurs when installing from source ... For now only copying the files into the environment solves it.

Why is there no update ?

lsewcx commented 7 months ago

Somehow, this directory:不知何故,这个目录: https://github.com/open-mmlab/mmaction2/tree/4d6c93474730cad2f25e51109adcf96824efc7a3/mmaction/models/localizers/drn did not end up in the pypi package:没有在pypi包中结束: https://pypi.org/project/mmaction2/1.2.0/不知何故,这个目录:https://github.com/open-mmlab/mmaction2/tree/4d6c93474730cad2f25e51109adcf96824efc7a3/mmaction/models/localizers/drn 没有在pypi软件包中结束:https://pypi.org/project/mmaction2/1.2.0/![](chrome-extension://dppcnmibpgmagiigcnfdjpnghplibbna/images/translator.png)

You can fix this temporarily by copying the dir into your installed mmaction2 package (......./site-packages/mmaction/models/localizers/您可以通过将目录复制到已安装的mmaction 2软件包(......./site-packages/mmaction/models/localizers/)来临时修复此问题)

有用感谢

SafaTinaztepe commented 3 months ago

Hi I got past this by installing from source. Pip version had this error, but installing local editable version worked for me.

liuzc188 commented 3 months ago

我在 site. package ....路径中 把有关drn的引入包 及后面注释了。

txy00001 commented 2 months ago

image Add it to init image