when I just try import matplotlib, then it doesn’t show any error msg.
but when I try some modules or a library using matplotlib like seaborn, it shows error msg.
If I write the import code below,
from matplotlib import pyplot as plt
soon it shows the msg below.
from matplotlib import pyplot as plt
and after few minuates, there comes the following error msg.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from matplotlib import pyplot as plt
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/matplotlib/pyplot.py:55
53 from cycler import cycler # noqa: F401
54 import matplotlib
---> 55 import matplotlib.colorbar
56 import matplotlib.image
57 from matplotlib import _api
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/matplotlib/colorbar.py:19
16 import numpy as np
18 import matplotlib as mpl
---> 19 from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
20 import matplotlib.artist as martist
21 import matplotlib.patches as mpatches
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/matplotlib/contour.py:15
13 import matplotlib as mpl
14 from matplotlib import _api, _docstring
---> 15 from matplotlib.backend_bases import MouseButton
16 from matplotlib.lines import Line2D
17 from matplotlib.path import Path
...
272 except (OSError, subprocess.CalledProcessError, plistlib.InvalidFileException):
273 return []
--> 274 return [Path(entry["path"]) for entry in d["_items"]]
KeyError: '_items'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
I tried everthing.
I set
import matplotlib as mpl
cache_dir = mpl.get_cachedir()
import shutil
shutil.rmtree(cache_dir)
!pip uninstall seaborn matplotlib -y
!pip install seaborn matplotlib
I made a virtual environment and re-installed every packages needed at onces.
python -m venv myenv
myenvScriptsactivate
source myenv/bin/activate
pip install numpy pandas matplotlib torch pydicom
when I install them all, it shows everything has gone alright.
but it shows error msg when I import a module from matplotlib.
It all has started when I try to setting up my new environment in my new M3-max macbook pro.
I didn’t have any problems like this when I was using intel macbook air 2017.
now I can’t do anything local environment.
Can you help me solve this problem?
Jaesol Shin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.