René's URL Explorer Experiment


Title: [Bug]: Backend falls back to Agg even though TkAgg will work · Issue #31715 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: Backend falls back to Agg even though TkAgg will work · Issue #31715 · matplotlib/matplotlib

X Title: [Bug]: Backend falls back to Agg even though TkAgg will work · Issue #31715 · matplotlib/matplotlib

Description: Bug summary I've set MPLBACKEND to be "TkAgg". When I import matplotlib.pyplot, the backend switches to "agg". I'm assuming this is some fallback behavior, which would be understandable except for the fact that TkAgg works just fine If I...

Open Graph Description: Bug summary I've set MPLBACKEND to be "TkAgg". When I import matplotlib.pyplot, the backend switches to "agg". I'm assuming this is some fallback behavior, which would be understandable except for ...

X Description: Bug summary I've set MPLBACKEND to be "TkAgg". When I import matplotlib.pyplot, the backend switches to "agg". I'm assuming this is some fallback behavior, which would b...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31715

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Backend falls back to Agg even though TkAgg will work","articleBody":"### Bug summary\n\nI've set MPLBACKEND to be \"TkAgg\". When I import `matplotlib.pyplot`, the backend switches to \"agg\". I'm assuming this is some fallback behavior, which would be understandable except for the fact that TkAgg works just fine\n\nIf I manually set backend with `matplotlib.use(\"TkAgg\")` before importing pyplot, things work as expected. \n\nI would like to avoid having to set the backend in python code, since I might use this with other backends as well\n\n### Code for reproduction\n\n```Python\n# test1.py\nimport matplotlib\nmatplotlib.use(\"TkAgg\")\nimport matplotlib.pyplot as plt\nassert plt.get_backend() == \"TkAgg\"  # This works. Plotting also uses Tk as expected\n\n# test2.py\nimport matplotlib.pyplot as plt\nassert plt.get_backend() == \"TkAgg\"  # AssertError. Got \"agg\" instead\n```\n\n### Actual outcome\n\nNo output for `test1.py`\n\nAssertionError for `test2.py`\n\n### Expected outcome\n\nNo output for either\n\n### Additional information\n\nOutput with DEBUG level logging, in case that might prove useful\n\n```\nDEBUG:matplotlib:matplotlib data path: xxxxxREDACTEDxxxxx/.venv/lib/python3.13/site-packages/matplotlib/mpl-data\nDEBUG:matplotlib:CONFIGDIR=xxxxxREDACTEDxxxxx\nDEBUG:matplotlib:interactive is False\nDEBUG:matplotlib:platform is linux\nDEBUG:matplotlib:CACHEDIR=xxxxxREDACTEDxxxxx\nDEBUG:matplotlib.font_manager:Using fontManager instance from xxxxxREDACTEDxxxxx/fontlist-v390.json\nDEBUG:matplotlib.pyplot:Loaded backend agg version v2.2.\n```\n\n### Operating system\n\nNixOS\n\n### Matplotlib Version\n\n3.10.9\n\n### Matplotlib Backend\n\nTkAgg\n\n### Python version\n\n3.13.12\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nuv","author":{"url":"https://github.com/parthkalgaonkar","@type":"Person","name":"parthkalgaonkar"},"datePublished":"2026-05-20T03:30:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/31715/matplotlib/issues/31715"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:73a582a0-4651-a663-a59a-f9057da4649d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC38E:B267E:B42645:F584B2:6A51ECBB
html-safe-nonce4fe582b9d7aa826a13358d736e79d590979e995dc8b9e6d4ca82e66ffc19c1af
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzhFOkIyNjdFOkI0MjY0NTpGNTg0QjI6NkE1MUVDQkIiLCJ2aXNpdG9yX2lkIjoiNTgzMjU0NDI2MDk0NDE2MTk3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac69f287d0d4998aaf06579ff19db7e2ba1e1198b6147cceb9dae80100b792d3d1
hovercard-subject-tagissue:4482873713
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/31715/issue_layout
twitter:imagehttps://opengraph.githubassets.com/78e332a471354c19333e18e7e511a9bbfa9a09fe542e0aa8189bcade6cd59aeb/matplotlib/matplotlib/issues/31715
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/78e332a471354c19333e18e7e511a9bbfa9a09fe542e0aa8189bcade6cd59aeb/matplotlib/matplotlib/issues/31715
og:image:altBug summary I've set MPLBACKEND to be "TkAgg". When I import matplotlib.pyplot, the backend switches to "agg". I'm assuming this is some fallback behavior, which would be understandable except for ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameparthkalgaonkar
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7aed05249554b889eb33d002851a973eebcc7e91
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/31715#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31715
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31715
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/31715
Reloadhttps://github.com/matplotlib/matplotlib/issues/31715
Reloadhttps://github.com/matplotlib/matplotlib/issues/31715
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/31715
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/31715
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 409 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
[Bug]: Backend falls back to Agg even though TkAgg will workhttps://github.com/matplotlib/matplotlib/issues/31715#top
backend: agghttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22backend%3A%20agg%22
https://github.com/parthkalgaonkar
parthkalgaonkarhttps://github.com/parthkalgaonkar
on May 20, 2026https://github.com/matplotlib/matplotlib/issues/31715#issue-4482873713
backend: agghttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22backend%3A%20agg%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.