open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.9k stars 1.65k forks source link

[Bug] ImportError: dlopen(/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/_ext.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZN2at3mps9MPSStream6commitEb' #3161

Open LeiChen9 opened 3 months ago

LeiChen9 commented 3 months ago

Prerequisite

Environment

Trace like: Traceback (most recent call last): File "demo/topdown_demo_with_mmdet.py", line 15, in from mmpose.apis import inference_topdown File "/Users/lei/Documents/Code/mmpose/mmpose/apis/init.py", line 2, in from .inference import (collect_multi_frames, inference_bottomup, File "/Users/lei/Documents/Code/mmpose/mmpose/apis/inference.py", line 17, in from mmpose.models.builder import build_pose_estimator File "/Users/lei/Documents/Code/mmpose/mmpose/models/init.py", line 8, in from .heads import * # noqa File "/Users/lei/Documents/Code/mmpose/mmpose/models/heads/init.py", line 11, in from .transformer_heads import EDPoseHead File "/Users/lei/Documents/Code/mmpose/mmpose/models/heads/transformer_heads/init.py", line 2, in from .edpose_head import EDPoseHead File "/Users/lei/Documents/Code/mmpose/mmpose/models/heads/transformer_heads/edpose_head.py", line 14, in from mmcv.ops import MultiScaleDeformableAttention File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/ops/init.py", line 2, in from .active_rotated_filter import active_rotated_filter File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/ops/active_rotated_filter.py", line 10, in ext_module = ext_loader.load_ext( File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext ext = importlib.import_module('mmcv.' + name) File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: dlopen(/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/_ext.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZN2at3mps9MPSStream6commitEb'

Reproduces the problem - code sample

https://mmpose.readthedocs.io/zh-cn/latest/installation.html

Reproduces the problem - command or script

python demo/topdown_demo_with_mmdet.py \ demo/mmdetection_cfg/rtmdet_m_8xb32-300e_coco.py \ https://download.openmmlab.com/mmdetection/v3.0/rtmdet/rtmdet_m_8xb32-300e_coco/rtmdet_m_8xb32-300e_coco_20220719_112220-229f527c.pth \ configs/animal_2d_keypoint/topdown_heatmap/animalpose/td-hm_hrnet-w32_8xb64-210e_animalpose-256x256.py \ https://download.openmmlab.com/mmpose/animal/hrnet/hrnet_w32_animalpose_256x256-1aa7f075_20210426.pth \ --input tests/data/animalpose/ca110.jpeg \ --show --draw-heatmap --det-cat-id=15

Reproduces the problem - error message

/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmengine/optim/optimizer/zero_optimizer.py:11: DeprecationWarning: TorchScript support for functional optimizers is deprecated and will be removed in a future PyTorch release. Consider using the torch.compile optimizer instead. from torch.distributed.optim import \ /opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/cnn/bricks/transformer.py:33: UserWarning: Fail to import MultiScaleDeformableAttention from mmcv.ops.multi_scale_deform_attn, You should install mmcv rather than mmcv-lite if you need this module. warnings.warn('Fail to import MultiScaleDeformableAttention from ' Traceback (most recent call last): File "demo/topdown_demo_with_mmdet.py", line 15, in from mmpose.apis import inference_topdown File "/Users/lei/Documents/Code/mmpose/mmpose/apis/init.py", line 2, in from .inference import (collect_multi_frames, inference_bottomup, File "/Users/lei/Documents/Code/mmpose/mmpose/apis/inference.py", line 17, in from mmpose.models.builder import build_pose_estimator File "/Users/lei/Documents/Code/mmpose/mmpose/models/init.py", line 8, in from .heads import * # noqa File "/Users/lei/Documents/Code/mmpose/mmpose/models/heads/init.py", line 11, in from .transformer_heads import EDPoseHead File "/Users/lei/Documents/Code/mmpose/mmpose/models/heads/transformer_heads/init.py", line 2, in from .edpose_head import EDPoseHead File "/Users/lei/Documents/Code/mmpose/mmpose/models/heads/transformer_heads/edpose_head.py", line 14, in from mmcv.ops import MultiScaleDeformableAttention File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/ops/init.py", line 2, in from .active_rotated_filter import active_rotated_filter File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/ops/active_rotated_filter.py", line 10, in ext_module = ext_loader.load_ext( File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext ext = importlib.import_module('mmcv.' + name) File "/opt/homebrew/anaconda3/envs/vis/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: dlopen(/opt/homebrew/anaconda3/envs/vis/lib/python3.8/site-packages/mmcv/_ext.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZN2at3mps9MPSStream6commitEb'

Additional information

No response

yxizhong commented 1 month ago

I encountered the same problem after adjusting the version of mmcv from 2.2.0 to 2.2.0rc4. My device is mac air m1. I solved the problem by adjusting the version of mmcv to 2.1.0. pip uninstall mmcv mmcv install mmcv==2.1.0