problem with matplotlib package

Answered

In the past everything was working fine. However recently I can't run matplotlib

when I try import matplotlib.pyplot as plt 

I get this error

import matplotlib.pyplot
ImportError: No module named pyplot

In Idle everything works fine. I also checked under the preference pan which interpreter I use. It is the same as for the idle. 

Moreover matplotlib is listed under packages listes in pycharm and it is the latest version of marplotlib. 

Any help or feedback here will be appreciated

1
2 comments

Hi Jakub! Do you have custom modules/packages in your project named matplotlib? There maybe name collision, by default PyCharm adds some thing to PYTHONPATH, e.g. Content and Source roots, and it can lead to confusion - wrong matplotlib is going to be imported. Try to add

import matplotlib
print(matplotlib)

in your script and check the output.

0
Avatar
Permanently deleted user

Thanks Pavel for your feedback. It was enlightening - indeed I had a name collision in naming on of the files - it got imported instead. Fantastic now everything works as should.

Thanks for your quick response. Best

0

Please sign in to leave a comment.