1

After a recent upgrade of apt packages, every time I tried to import matplotlib.pyplot, this error pops up

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/chiu/.local/lib/python3.10/site-packages/matplotlib/pyplot.py", line 66, in <module>
    from matplotlib.figure import Figure, FigureBase, figaspect
  File "/home/chiu/.local/lib/python3.10/site-packages/matplotlib/figure.py", line 43, in <module>
    from matplotlib import _blocking_input, backend_bases, _docstring, projections
  File "/home/chiu/.local/lib/python3.10/site-packages/matplotlib/projections/__init__.py", line 58, in <module>
    from mpl_toolkits.mplot3d import Axes3D
  File "/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py", line 1, in <module>
    from .axes3d import Axes3D
  File "/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 23, in <module>
    from matplotlib import _api, cbook, docstring, _preprocess_data
ImportError: cannot import name 'docstring' from 'matplotlib' (/home/chiu/.local/lib/python3.10/site-packages/matplotlib/__init__.py)

I have tried to reinstall matplotlib multiple times. I'm on Ubuntu 22.04 with Python 3.10.12. Any suggestions would be appreciated!

I have tried to reinstall matplotlib through pip. I was expecting matplotlib.pyplot to be imported.

2
  • 1
    Please see this GitHub issue github.com/matplotlib/matplotlib/issues/26827 Commented Oct 2, 2023 at 17:55
  • apt remove python3-matplotlib solved the problem. Thank you so much!! Commented Oct 4, 2023 at 18:38

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.