Score:1

ImportError: No module named matplotlib.pyplot ubuntu 21,04

ir flag
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('seaborn-white')

ax1 = plt.axes()
ax2 = plt.axes([0.65, 0.65, 0.2, 0.2])
plt.show()

I have installed matplotlib using 'sudo apt-get install python3-matplotlib'and I have also tried installing it using 'pip'and 'pip3' but yet, I get the response that matplotlib has already been installed with the latest version and if i run my code i get 'ImportError: No module named matplotlib.pyplot'.

Gagan avatar
cn flag
Do you have multiple python versions?
Jean-Bernard avatar
ru flag
Same issue for me. Try this in a terminal, it solved for me: pip install matplotlib
Score:1
ir flag

I did it by removing the python 2 package that came with the ubuntu OS and also removed the python 3 package then installed only the python 3 package again. Then it worked.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.