Skip to content

ImportError: cannot import name '_c_internal_utils' from partially initialized module 'matplotlib' (most likely due to a circular import) #3837

Open
@ououch123

Description

@ououch123

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. The bug has not been fixed in the latest version.

Describe the bug
A clear and concise description of what the bug is.

D:\SoftWare\anaconda3\envs\mmsegmentation\python.exe F:\GaoFen\mmsegmentation\demo\image_demo.py F:\GaoFen\mmsegmentation\demo\demo.png F:\GaoFen\mmsegmentation\configs\pspnet\pspnet_r50-d8_4xb2-40k_cityscapes-512x1024.py D:\Download\pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cuda:0 --out-file result.jpg
D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\mmengine\logging\history_buffer.py:5: UserWarning: The NumPy module was reloaded (imported a second time). This can in some cases result in small but subtle issues and is discouraged.
import numpy as np
F:\GaoFen\mmsegmentation\mmseg\models\losses\cross_entropy_loss.py:250: UserWarning: Default avg_non_ignore is False, if you would like to ignore the certain label and average loss over non-ignore labels, which is the same with PyTorch official cross_entropy, set avg_non_ignore=True.
warnings.warn(
Loads checkpoint by local backend from path: D:\Download\pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth
D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\mmengine\visualization\visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the save_dir argument.
warnings.warn(f'Failed to add {vis_backend.class}, '
Traceback (most recent call last):
File "F:\GaoFen\mmsegmentation\demo\image_demo.py", line 51, in
main()
File "F:\GaoFen\mmsegmentation\demo\image_demo.py", line 38, in main
show_result_pyplot(
File "F:\GaoFen\mmsegmentation\mmseg\apis\inference.py", line 170, in show_result_pyplot
visualizer = SegLocalVisualizer(
File "F:\GaoFen\mmsegmentation\mmseg\visualization\local_visualizer.py", line 77, in init
super().init(name, image, vis_backends, save_dir, **kwargs)
File "D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\mmengine\visualization\visualizer.py", line 212, in init
self.ax_save) = self._initialize_fig(fig_save_cfg)
File "D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\mmengine\visualization\visualizer.py", line 327, in initialize_fig
from matplotlib.backends.backend_agg import FigureCanvasAgg
File "D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\matplotlib_init
.py", line 161, in
from . import _api, _version, cbook, _docstring, rcsetup
File "D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\matplotlib\cbook.py", line 32, in
from matplotlib import _api, _c_internal_utils
ImportError: cannot import name 'c_internal_utils' from partially initialized module 'matplotlib' (most likely due to a circular import) (D:\SoftWare\anaconda3\envs\mmsegmentation\lib\site-packages\matplotlib_init.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions