I'm recently trying to do something with Tensorflow. The installation seems very fine until I've encountered this problem. When importing matplotlib.pyplot, AttributeError was thrown. Below is the detail:
>>> import matplotlib.pyplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/syine/venv/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2349, in <module>
switch_backend(rcParams["backend"])
File "/home/syine/venv/lib/python3.7/site-packages/matplotlib/__init__.py", line 820, in __getitem__
plt.switch_backend(rcsetup._auto_backend_sentinel)
File "/home/syine/venv/lib/python3.7/site-packages/matplotlib/pyplot.py", line 212, in switch_backend
newbackend[9:] if newbackend.startswith("module://")
AttributeError: 'object' object has no attribute 'startswith'
Seemingly it's an internal error in the module, however I can't find any hint to solve the issue.
I tried reinstalling matplotlib and all of its dependencies (FreeType, libpng, NumPy, setuptools, cycler, dateutil, kiwisolver, pyparsing), but none of them could solve the problem.
from matplotlib import rcParams, rcParamsDefault, get_backend, rcParamsOrigwork without errors? it seems thatnewbackendis no string, hence it has no 'startswith' methodmatplotlib.rcsetup.all_backendsprint you out? (you have to doimport matplotlib.rcsetupfirst)import matplotlib; print(matplotlib.__version__). How exactly did you install matplotlib. Also what doesprint(matplotlib.rcParams["backend"])result in?