Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Help regarding - cannot import name 'pyplot' error
-
Hi,
I often get "cannot import name 'pyplot' error"
when i try to import matplotlibAs a work around, I go to Examples folder and run any plotting example, then it works,
after which i can import matplotlib normally.The error states something about "frozen importlib._bootstrap"
How can i avoid this error, in pythonista 3Thank you.
# Histogram # Basic plot import numpy as np import matplotlib.pyplot as plt height = [3, 12, 5, 18, 45] bars = ('A', 'B', 'C', 'D', 'E') y_pos = np.arange(len(bars)) plt.bar(y_pos, height, color=(0.2, 0.4, 0.6, 0.6)) # Custom Axis title plt.xlabel('X Axis Title', fontweight='bold', color = 'red', fontsize='17', horizontalalignment='center') plt.show()```
-
Do you have your own file that you created called pyplot.py or matplotlib.py? Sometimes creating Python files with names like the modules that you are trying to import can cause these kind of issues.
-
Thank you very much @ccc for your constant support and prompt help.
Yes, I found some old file, i had named matplotlib.py ,
I have renamed it and now everything works fine.
Silly mistake on my part when i started with pythonista.