Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm - Importing Matplotlib

I've installed Pycharm and using Anaconda 3 as my interpreter. I cannot import Matplotlib (or Seaborn). When I run 'import matplotlib.pyplot as plt' I get the following:--

import matplotlib.pyplot as plt

Backend Qt5Agg is interactive backend. Turning interactive mode on.

Traceback (most recent call last):
 
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.2.3\helpers\pydev\pydev_ipython\inputhook.py", line 502, in enable_gui
    gui_hook = guis[gui] KeyError: 'qt5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
      File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 123, in enable_gui
        return real_enable_gui(gui, app)
      File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pydev\pydev_ipython\inputhook.py", line 508, in enable_gui
        raise ValueError(e)
    ValueError: Invalid GUI request 'qt5', valid ones are:dict_keys(['osx', 'gtk', 'qt4', 'qt', 'gtk3', 'glut', 'pyglet',
'wx', 'none', 'tk'])

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-eff513f636fd>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 2512, in <module>
    install_repl_displayhook()
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 165, in install_repl_displayhook
    ip.enable_gui(ipython_gui_name)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 125, in enable_gui
    raise UsageError("%s" % e)
IPython.core.error.UsageError: Invalid GUI request 'qt5', valid ones are:dict_keys(['osx', 'gtk', 'qt4', 'qt', 'gtk3', 'glut', 'pyglet', 'wx', 'none', 'tk'])
like image 483
Mehwish Avatar asked Oct 19 '25 17:10

Mehwish


1 Answers

Try running pip install PyQt5 in the command line (not Python, windows cmd or unix terminal). If this doesn't work - try conda install PyQt5. Though this doesn't make sense as matplotlib uses tkinter.

like image 177
VanDarkholme Avatar answered Oct 22 '25 07:10

VanDarkholme



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!