Title: [Bug]: Crashes trying to use QtAgg backend · Issue #23131 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Crashes trying to use QtAgg backend · Issue #23131 · matplotlib/matplotlib
X Title: [Bug]: Crashes trying to use QtAgg backend · Issue #23131 · matplotlib/matplotlib
Description: Bug summary I tried doing pip install pyside6 and using matplotlib and a chart window appears, but just hangs. Code for reproduction import matplotlib as mpl import matplotlib.pyplot as plt mpl.use('QtAgg') # 'QT5Agg' also fails, 'TkAgg'...
Open Graph Description: Bug summary I tried doing pip install pyside6 and using matplotlib and a chart window appears, but just hangs. Code for reproduction import matplotlib as mpl import matplotlib.pyplot as plt mpl.use...
X Description: Bug summary I tried doing pip install pyside6 and using matplotlib and a chart window appears, but just hangs. Code for reproduction import matplotlib as mpl import matplotlib.pyplot as plt mpl.use...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23131
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Crashes trying to use QtAgg backend","articleBody":"### Bug summary\n\nI tried doing `pip install pyside6` and using matplotlib and a chart window appears, but just hangs.\r\n\r\n\n\n### Code for reproduction\n\n```python\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt\r\n\r\nmpl.use('QtAgg') # 'QT5Agg' also fails, 'TkAgg' works.\r\n\r\nplt.plot([1, 2, 3, 2, 3, 4])\r\n\r\nplt.show()\n```\n\n\n### Actual outcome\n\nChart window opens and hangs.\r\n\r\n\r\n\n\n### Expected outcome\n\nShould work the same as when the backend is `TkAgg`.\r\n\n\n### Additional information\n\nI'm running the code in IntelliJ and everything worked fine before I installed Qt.\r\n\r\nI'm a newbie and a bit confused as to what exactly I need to do to use Qt as a backend. Note that I'm just exploring/learning, I don't have a _reason_ to want to use Qt over Tk or anything else.\r\n\r\nI've read [this page on Qt bindings](https://github.com/matplotlib/matplotlib/blob/96ddc6728ce09cb61f6b6c53714755fe0936b106/doc/api/backend_qt_api.rst) (the text on this page doesn't show up in the actual docs)\r\n\r\nAnd also saw https://github.com/matplotlib/matplotlib/pull/19255 that seems to add support and was merged and I'm using a later version `3.5.2`.\r\n\r\nAnd I've read [this page in the docs](https://matplotlib.org/3.5.0/users/explain/backends.html#how-do-i-select-the-qt-implementation) and it seems to imply (but not say) that all I need to do is install PySide6 and it should work.\r\n\r\nWeirdly, if I just use the code:\r\n```py\r\nimport matplotlib.pyplot as plt\r\n\r\nplt.plot([1, 2, 3, 2, 3, 4])\r\n\r\nplt.show()\r\n```\r\nIt works, which is weird for two reasons:\r\n1. This means that just _importing matplotlib_ invokes different behaviour to importing `matplotlib.pyplot`.\r\n2. Not importing matplotlib directly (only `pyplot`) results in the message \"Backend MacOSX is interactive backend. Turning interactive mode on.\". Weird as I'm on Windows, and if I then run `plt.get_backend()` it says `QtAgg`. It's all so confusing!\n\n### Operating system\n\nWindows 11\n\n### Matplotlib Version\n\n3.5.2\n\n### Matplotlib Backend\n\nQtAgg, Qt5Agg\n\n### Python version\n\n3.10.2\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/davidgilbertson","@type":"Person","name":"davidgilbertson"},"datePublished":"2022-05-25T02:27:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/23131/matplotlib/issues/23131"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bf2d8f10-8d4a-b1ff-e0c0-c4764aee2b83 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA04:2049AA:2E6AA94:3EDB7EC:6A53C2E1 |
| html-safe-nonce | 051cd31e34ac3818a7c7e12853ca20b7d6f22ee04e3ec41028bef153d18548ab |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTA0OjIwNDlBQToyRTZBQTk0OjNFREI3RUM6NkE1M0MyRTEiLCJ2aXNpdG9yX2lkIjoiNDk3NTcwMjA2OTI1ODQ3MDExMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d953b3985db0a6b7fbeb0f1d8c6fdc5db40d88ac47cdad8fed512e7196b321d1 |
| hovercard-subject-tag | issue:1247367775 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/23131/issue_layout |
| twitter:image | https://opengraph.githubassets.com/30ecd1e81561287d1b49bc417f051b6c7d49e2d3ad4b025d66a346c60167d8d1/matplotlib/matplotlib/issues/23131 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/30ecd1e81561287d1b49bc417f051b6c7d49e2d3ad4b025d66a346c60167d8d1/matplotlib/matplotlib/issues/23131 |
| og:image:alt | Bug summary I tried doing pip install pyside6 and using matplotlib and a chart window appears, but just hangs. Code for reproduction import matplotlib as mpl import matplotlib.pyplot as plt mpl.use... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidgilbertson |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width