1

I've installed python2.7 and installed matplotlib using pip. When I execute:

% matplotlib qt

It get the error:

No module named pyqt4, pyqt5...

So I installed pyqt4 using .whl file, and the error becomes:

No module named pyqt5

I've searched that pyqt5 can be easy installed using pip3 install pyqt5, but not for pip.

Also I remembered that I have solved this problem by downgrading jupyter before but I can't remember it exactly.

I have searched the web for a while but can't find a solution, how can I get rid of this error in a most simple way?

enter image description here

8
  • Which OS are you using? Are you using virtualenv or not? Commented Oct 28, 2017 at 8:08
  • @TarunLalwani Windows, no virtualenv. Actually, this problem happens both in windows and mac, and mac is fixed and it is OK now. I also have fixed windows before, but I can't remember the method. Commented Oct 28, 2017 at 13:43
  • Why not install pyside instead? I just did pip install pyside and it works for me after that Commented Oct 28, 2017 at 14:38
  • @TarunLalwani not working for me. still No module named pyqt5 Commented Oct 29, 2017 at 2:29
  • Then there are other things you can try. Set a environment variable in windows MPLBACKEND with value as Qt4Agg. See this for more available backend matplotlib.org/tutorials/introductory/…. Also you can try %matplotlib qt4 instead of %matplotlib qt Commented Oct 29, 2017 at 6:45

1 Answer 1

1
+50

There are different ways to specify the backend for matplotlib

Using Environment Variable

Set a environment variable in windows MPLBACKEND with value as Qt4Agg.

See this for more available backend

https://matplotlib.org/tutorials/introductory/usage.html#what-is-a-backend

Using names

Also you can try %matplotlib qt4 instead of %matplotlib qt

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.