I recently installed the last version of matplotlib. As I try to import into Visual Studio Code I receive this error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Untitled-2.ipynb Cella 1 in 1
----> 1 import matplotlib
File ~AppDataRoamingPythonPython310site-packagesmatplotlib__init__.py:109
105 from packaging.version import parse as parse_version
107 # cbook must import matplotlib only within function
108 # definitions, so it is safe to import from it here.
--> 109 from . import _api, _version, cbook, docstring, rcsetup
110 from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
111 from matplotlib.cbook import mplDeprecation # deprecated
File ~AppDataRoamingPythonPython310site-packagesmatplotlibdocstring.py:1
----> 1 from matplotlib._docstring import * # noqa: F401, F403
2 from matplotlib import _api
3 _api.warn_deprecated(
4 "3.6", obj_type='module', name=f"{__name__}")
ModuleNotFoundError: No module named 'matplotlib._docstring'
I used pip to install the library.
2
Answers
I solved by upgrading the Python version (from 3.10 to 3.11), pip version and matplotlib
Ctrl+Shift+P
Python: Select Interpreter
Select the interpreter that has
matplotlib
installed.