{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6567","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6567/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6567/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6567/events","html_url":"https://github.com/matplotlib/matplotlib/issues/6567","id":159669143,"number":6567,"title":"qt_compat fails to identify PyQt5","user":{"login":"DavidHowlett","id":4719098,"avatar_url":"https://avatars.githubusercontent.com/u/4719098?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidHowlett","html_url":"https://github.com/DavidHowlett","followers_url":"https://api.github.com/users/DavidHowlett/followers","following_url":"https://api.github.com/users/DavidHowlett/following{/other_user}","gists_url":"https://api.github.com/users/DavidHowlett/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidHowlett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidHowlett/subscriptions","organizations_url":"https://api.github.com/users/DavidHowlett/orgs","repos_url":"https://api.github.com/users/DavidHowlett/repos","events_url":"https://api.github.com/users/DavidHowlett/events{/privacy}","received_events_url":"https://api.github.com/users/DavidHowlett/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-10T16:07:50Z","updated_at":"2016-06-10T16:27:53Z","closed_at":null,"body":"I installed the latest version of anaconda which came with python 3.5.1 and matplotlib 1.5.1\r\nOther software I am using:\r\n  - Windows 10\r\n  - Qt 5\r\n  - PyQt 5.6\r\n\r\nWith this setup the one line program below fails:\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n```\r\n\r\nThe stack trace is shown below:\r\n\r\n```code\r\nTraceback (most recent call last):\r\n  File \"G:\\reusable\\junk.py\", line 1, in <module>\r\n    import matplotlib.pyplot as plt\r\n  File \"c:\\anaconda3\\lib\\site-packages\\matplotlib\\pyplot.py\", line 114, in <module>\r\n    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()\r\n  File \"c:\\anaconda3\\lib\\site-packages\\matplotlib\\backends\\__init__.py\", line 32, in pylab_setup\r\n    globals(),locals(),[backend_name],0)\r\n  File \"c:\\anaconda3\\lib\\site-packages\\matplotlib\\backends\\backend_qt4agg.py\", line 18, in <module>\r\n    from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase\r\n  File \"c:\\anaconda3\\lib\\site-packages\\matplotlib\\backends\\backend_qt5agg.py\", line 15, in <module>\r\n    from .backend_qt5 import QtCore\r\n  File \"c:\\anaconda3\\lib\\site-packages\\matplotlib\\backends\\backend_qt5.py\", line 31, in <module>\r\n    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__\r\n  File \"c:\\anaconda3\\lib\\site-packages\\matplotlib\\backends\\qt_compat.py\", line 124, in <module>\r\n    from PyQt4 import QtCore, QtGui\r\nImportError: cannot import name 'QtCore'\r\n```\r\n\r\nMy best understanding of the stack trace is that in the QT 5 backend qt_compat.py is trying to import things from PyQt4 rather then PyQt5.  \r\n\r\nI figured out I can work around the crash by explicitly naming a backend like this:\r\n\r\n```python\r\nimport matplotlib\r\nmatplotlib.use(\"Qt5Agg\")\r\nimport matplotlib.pyplot as plt\r\n```\r\n\r\nThis works for me but I suspect that the Qt 5 backend should not be trying to import PyQt4.\r\n\r\nI attach a screenshot of the output of my debugger below.\r\nhttps://cloud.githubusercontent.com/assets/4719098/15970896/f49b2d66-2f2e-11e6-8c5e-f8ace20343b3.png\r\n\r\nThe grey box contains the values of all the local variables at the time of the crash\r\n\r\nI don't know if this is relevant but in the past I have installed then uninstalled:\r\n\r\n  - QT 4  \r\n  - PyQt 4\r\n  - PySide\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/225230265","html_url":"https://github.com/matplotlib/matplotlib/issues/6567#issuecomment-225230265","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6567","id":225230265,"user":{"login":"DavidHowlett","id":4719098,"avatar_url":"https://avatars.githubusercontent.com/u/4719098?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidHowlett","html_url":"https://github.com/DavidHowlett","followers_url":"https://api.github.com/users/DavidHowlett/followers","following_url":"https://api.github.com/users/DavidHowlett/following{/other_user}","gists_url":"https://api.github.com/users/DavidHowlett/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidHowlett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidHowlett/subscriptions","organizations_url":"https://api.github.com/users/DavidHowlett/orgs","repos_url":"https://api.github.com/users/DavidHowlett/repos","events_url":"https://api.github.com/users/DavidHowlett/events{/privacy}","received_events_url":"https://api.github.com/users/DavidHowlett/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T16:27:53Z","updated_at":"2016-06-10T16:27:53Z","body":"Is there anything else I can do to be helpful?"}}
{"actor":{"display_login":"DavidHowlett"}}