Title: Make matplotlib fail more gracefully in headless environments · Issue #6739 · matplotlib/matplotlib · GitHub
Open Graph Title: Make matplotlib fail more gracefully in headless environments · Issue #6739 · matplotlib/matplotlib
X Title: Make matplotlib fail more gracefully in headless environments · Issue #6739 · matplotlib/matplotlib
Description: This is reproducible on any headless environment using matplotlib 1.5.1. On my system, the following script: from matplotlib import pyplot as plt plt.plot([1, 2], [1, 2]) Will produce the following traceback: ----------------------------...
Open Graph Description: This is reproducible on any headless environment using matplotlib 1.5.1. On my system, the following script: from matplotlib import pyplot as plt plt.plot([1, 2], [1, 2]) Will produce the following...
X Description: This is reproducible on any headless environment using matplotlib 1.5.1. On my system, the following script: from matplotlib import pyplot as plt plt.plot([1, 2], [1, 2]) Will produce the following...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/6739
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make matplotlib fail more gracefully in headless environments","articleBody":"This is reproducible on any headless environment using matplotlib 1.5.1. On my system, the following script:\n\n``` python\nfrom matplotlib import pyplot as plt\nplt.plot([1, 2], [1, 2])\n```\n\nWill produce the following traceback:\n\n```\n---------------------------------------------------------------------------\nTclError Traceback (most recent call last)\n\u003cipython-input-2-8dd816f9ddc7\u003e in \u003cmodule\u003e()\n----\u003e 1 plt.plot([1, 2], [1, 2])\n\n/home/goldbaum/.virtualenvs/yt-dev/local/lib/python2.7/site-packages/matplotlib/pyplot.pyc in plot(*args, **kwargs)\n 3145 @_autogen_docstring(Axes.plot)\n 3146 def plot(*args, **kwargs):\n-\u003e 3147 ax = gca()\n 3148 # allow callers to override the hold state by passing hold=True|False\n 3149 washold = ax.ishold()\n\n/home/goldbaum/.virtualenvs/yt-dev/local/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gca(**kwargs)\n 926 matplotlib.figure.Figure.gca : The figure's gca method.\n 927 \"\"\"\n--\u003e 928 return gcf().gca(**kwargs)\n 929\n 930 # More ways of creating axes:\n\n/home/goldbaum/.virtualenvs/yt-dev/local/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gcf()\n 576 return figManager.canvas.figure\n 577 else:\n--\u003e 578 return figure()\n 579\n 580\n\n/home/goldbaum/.virtualenvs/yt-dev/local/lib/python2.7/site-packages/matplotlib/pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, **kwargs)\n 525 frameon=frameon,\n 526 FigureClass=FigureClass,\n--\u003e 527 **kwargs)\n 528\n 529 if figLabel:\n\n/home/goldbaum/.virtualenvs/yt-dev/local/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.pyc in new_figure_manager(num, *args, **kwargs)\n 82 FigureClass = kwargs.pop('FigureClass', Figure)\n 83 figure = FigureClass(*args, **kwargs)\n---\u003e 84 return new_figure_manager_given_figure(num, figure)\n 85\n 86\n\n/home/goldbaum/.virtualenvs/yt-dev/local/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.pyc in new_figure_manager_given_figure(num, figure)\n 90 \"\"\"\n 91 _focus = windowing.FocusManager()\n---\u003e 92 window = Tk.Tk()\n 93 window.withdraw()\n 94\n\n/usr/lib/python2.7/lib-tk/Tkinter.pyc in __init__(self, screenName, baseName, className, useTk, sync, use)\n 1765 baseName = baseName + ext\n 1766 interactive = 0\n-\u003e 1767 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)\n 1768 if useTk:\n 1769 self._loadtk()\n\nTclError: no display name and no $DISPLAY environment variable\n```\n\nI think it would be much nicer if backends somehow detected these sorts of errors, fell back to the Agg backend (probably with a warning) and then goes ahead and makes the plot.\n","author":{"url":"https://github.com/ngoldbaum","@type":"Person","name":"ngoldbaum"},"datePublished":"2016-07-14T18:34:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/6739/matplotlib/issues/6739"}
| 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:070d183f-f598-0b31-9413-cead911628ed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8992:21C9D6:4D5315E:6BB9885:6A54F59F |
| html-safe-nonce | a412f77673f907388a5573834b8566adee39da8895ed585ce9ff9415c2b41fbf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTkyOjIxQzlENjo0RDUzMTVFOjZCQjk4ODU6NkE1NEY1OUYiLCJ2aXNpdG9yX2lkIjoiMjk1ODAyNDY1NTIwNDg0MDg2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 780a8933db116f44112f46985986250b71c82a7ee25328f32a52afcdc3e5144e |
| hovercard-subject-tag | issue:165628616 |
| 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/6739/issue_layout |
| twitter:image | https://opengraph.githubassets.com/08cf6f4cb455e602ba6be845753f28267bde2810dee4e94dfe929a93eefb3f56/matplotlib/matplotlib/issues/6739 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/08cf6f4cb455e602ba6be845753f28267bde2810dee4e94dfe929a93eefb3f56/matplotlib/matplotlib/issues/6739 |
| og:image:alt | This is reproducible on any headless environment using matplotlib 1.5.1. On my system, the following script: from matplotlib import pyplot as plt plt.plot([1, 2], [1, 2]) Will produce the following... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ngoldbaum |
| hostname | github.com |
| expected-hostname | github.com |
| None | eae2aab99907699a22d2c8449aa683ca74454fca87211b98f7c7b722086b2839 |
| 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 | dd26d3896747463b6bd56edd5e290edb595c3cbc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width