Title: RuntimeError: latex was not able to process the following string: b'$\\\\mathdefault{-2}$' · Issue #17673 · matplotlib/matplotlib · GitHub
Open Graph Title: RuntimeError: latex was not able to process the following string: b'$\\\\mathdefault{-2}$' · Issue #17673 · matplotlib/matplotlib
X Title: RuntimeError: latex was not able to process the following string: b'$\\\\mathdefault{-2}$' · Issue #17673 · matplotlib/matplotlib
Description: Bug report Bug summary Hi, I am working on a linux system which I do not have root privileges to. As such, I have created a virtual environment so I can use modules as I need without installing them fully on the system. I experienced an ...
Open Graph Description: Bug report Bug summary Hi, I am working on a linux system which I do not have root privileges to. As such, I have created a virtual environment so I can use modules as I need without installing the...
X Description: Bug report Bug summary Hi, I am working on a linux system which I do not have root privileges to. As such, I have created a virtual environment so I can use modules as I need without installing the...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/17673
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RuntimeError: latex was not able to process the following string: b'$\\\\\\\\mathdefault{-2}$'","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nHi,\r\n\r\nI am working on a linux system which I do not have root privileges to. As such, I have created a virtual environment so I can use modules as I need without installing them fully on the system.\r\n\r\nI experienced an error when trying to use Latex as a text renderer for plots I am making for publication in my virtual environment. \r\nI do not get an error and everything works fine when I run the same code snippet outside of my virtual environment and I need to work in my virtual environment as there are certain modules I need to compute other parts the code.\r\n\r\nI am aware a similar issue was raised [here](https://github.com/matplotlib/matplotlib/issues/5076/) the resolution appears to be reinstall/update whatever Tex distribution I have but I can not do that as I do not have root privileges on my system. So is there a work around I could use in my vitual environment?\r\n\r\nThanks in advance.\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n```python\r\nimport matplotlib as mpl\r\nmpl.use('Agg') # Use this backend for writing plots to file\r\n\r\nimport matplotlib.pyplot as plt\r\nplt.style.use('seaborn-talk')\r\nmpl.rcParams['figure.figsize'] = [10, 8]\r\nmpl.rcParams['figure.autolayout'] = True\r\nmpl.rcParams['text.usetex'] = True # \u003c------- This seems to be issue\r\nmpl.rcParams['font.family'] = 'serif'\r\nmpl.rcParams['font.serif'] = 'Computer Modern Roman'\r\nmpl.rcParams['lines.linewidth'] = 1.25\r\nmpl.rcParams['lines.markersize'] = 6\r\n\r\n# Simple Plot of Data\r\nplt.plot(np.arange(10), np.sin(np.arange(10)))\r\nplt.xlim(0, 2*np.pi)\r\nplt.ylim(-3.2, 3.2)\r\nplt.xlabel(r'$x$')\r\nplt.ylabel(r'$u(x, t) / u_{rms}(x, t)$')\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/texmanager.py\", line 306, in _run_checked_subprocess\r\n stderr=subprocess.STDOUT)\r\n File \"/usr/lib/python3.6/subprocess.py\", line 356, in check_output\r\n **kwargs).stdout\r\n File \"/usr/lib/python3.6/subprocess.py\", line 438, in run\r\n output=stdout, stderr=stderr)\r\nsubprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '/home/ecarroll/.cache/matplotlib/tex.cache/f0d1ad490f795d8f5a7626e4d07943a6.tex']' returned non-zero exit status 1.\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n File \"./Plotting/plot_lce_triaddynamics_snaps\u0026video.py\", line 333, in \u003cmodule\u003e\r\n plt.savefig(output_dir + \"/SNAPS/Triad_SNAPS_{:05d}.png\".format(2), format='png', dpi = 400)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/pyplot.py\", line 723, in savefig\r\n res = fig.savefig(*args, **kwargs)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/figure.py\", line 2203, in savefig\r\n self.canvas.print_figure(fname, **kwargs)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/backend_bases.py\", line 2126, in print_figure\r\n **kwargs)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py\", line 514, in print_png\r\n FigureCanvasAgg.draw(self)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py\", line 393, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/figure.py\", line 1729, in draw\r\n self.tight_layout(**self._tight_parameters)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/cbook/deprecation.py\", line 358, in wrapper\r\n return func(*args, **kwargs)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/figure.py\", line 2496, in tight_layout\r\n pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/tight_layout.py\", line 360, in get_tight_layout_figure\r\n pad=pad, h_pad=h_pad, w_pad=w_pad)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/tight_layout.py\", line 109, in auto_adjust_subplotpars\r\n tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/tight_layout.py\", line 110, in \u003clistcomp\u003e\r\n if ax.get_visible()])\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/axes/_base.py\", line 4323, in get_tightbbox\r\n bb_xaxis = self.xaxis.get_tightbbox(renderer)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/axis.py\", line 1188, in get_tightbbox\r\n self._update_label_position(renderer)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/axis.py\", line 2021, in _update_label_position\r\n bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/axis.py\", line 2006, in _get_tick_boxes_siblings\r\n tlb, tlb2 = axx.xaxis._get_tick_bboxes(ticks_to_draw, renderer)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/axis.py\", line 1174, in _get_tick_bboxes\r\n for tick in ticks if tick.label1.get_visible()],\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/axis.py\", line 1174, in \u003clistcomp\u003e\r\n for tick in ticks if tick.label1.get_visible()],\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/text.py\", line 905, in get_window_extent\r\n bbox, info, descent = self._get_layout(self._renderer)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/text.py\", line 300, in _get_layout\r\n clean_line, self._fontproperties, ismath=ismath)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py\", line 204, in get_text_width_height_descent\r\n s, fontsize, renderer=self)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/texmanager.py\", line 458, in get_text_width_height_descent\r\n dvifile = self.make_dvi(tex, fontsize)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/texmanager.py\", line 340, in make_dvi\r\n texfile], tex)\r\n File \"/home/ecarroll/ecpy/lib/python3.6/site-packages/matplotlib/texmanager.py\", line 319, in _run_checked_subprocess\r\n exc=exc.output.decode('utf-8'))) from exc\r\nRuntimeError: latex was not able to process the following string:\r\nb'$\\\\\\\\mathdefault{0}$'\r\n\r\nHere is the full report generated by latex:\r\nThis is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\nentering extended mode\r\n\r\n(/home/ecarroll/.cache/matplotlib/tex.cache/f0d1ad490f795d8f5a7626e4d07943a6.te\r\nx\r\nLaTeX2e \u003c2017-04-15\u003e\r\nBabel \u003c3.18\u003e and hyphenation patterns for 3 language(s) loaded.\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\r\nDocument Class: article 2014/09/29 v1.4h Standard LaTeX document class\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))\r\n(/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)\r\n\r\n! LaTeX Error: File `type1ec.sty' not found.\r\n\r\nType X to quit or \u003cRETURN\u003e to proceed,\r\nor enter new name. (Default extension: sty)\r\n\r\nEnter file name:\r\n! Emergency stop.\r\n\u003cread *\u003e\r\n\r\nl.6 \\usepackage\r\n {type1ec}^^M\r\nNo pages of output.\r\nTranscript written on f0d1ad490f795d8f5a7626e4d07943a6.log.\r\n\r\n```\r\n\r\n**Expected outcome**\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\nThe expected outcome should be a plot where all the text and labels are rendered in Tex\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Ubuntu 18.04.3 LTS\r\n * Matplotlib version: matplotlib==3.2.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): Default backend is TkAgg but I switch to use Agg in the code\r\n * Python version: 3.6.9\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n**Libraries in my virtual environment:**\r\n```\r\nappdirs==1.4.4\r\ncertifi==2020.4.5.2\r\ncffi==1.14.0\r\ncolorama==0.4.3\r\ncryptography==2.9.2\r\ncycler==0.10.0\r\ndata==0.4\r\ndecorator==4.4.2\r\ndistlib==0.3.0\r\nfilelock==3.0.12\r\nfuncsigs==1.0.2\r\nfuture==0.18.2\r\nh5py==2.10.0\r\nicc-rt==2020.0.133\r\nimportlib-metadata==1.6.1\r\nimportlib-resources==2.0.1\r\nintel-openmp==2020.0.133\r\nJinja2==2.11.2\r\njoblib==0.15.1\r\nkiwisolver==1.2.0\r\nlatex==0.7.0\r\nlatexbuild==0.2.2\r\nllvmlite==0.33.0\r\nMako==1.1.3\r\nMarkdown==3.2.2\r\nMarkupSafe==1.1.1\r\nmatplotlib==3.2.2\r\nmpmath==1.1.0\r\nnumba==0.50.0\r\nnumpy==1.18.5\r\npandas==1.0.4\r\npbr==5.4.5\r\npdoc3==0.8.1\r\npipenv==2020.6.2\r\npycparser==2.20\r\nPyOpenGL==3.1.5\r\npyOpenSSL==19.1.0\r\npyparsing==2.4.7\r\npyptex==1.0.1\r\npython-dateutil==2.8.1\r\npytz==2020.1\r\nPyYAML==5.3.1\r\nscikit-learn==0.23.1\r\nscipy==1.4.1\r\nshutilwhich==1.1.0\r\nsix==1.15.0\r\nstevedore==2.0.0\r\nsympy==1.6\r\ntempdir==0.7.1\r\nthreadpoolctl==2.1.0\r\nvirtualenv==20.0.23\r\nvirtualenv-clone==0.5.4\r\nvirtualenvwrapper==4.8.4\r\nzipp==3.1.0\r\n```\r\n**Libraries in my base Python:**\r\n```\r\nappdirs==1.4.4\r\nasn1crypto==0.24.0\r\nattrs==17.4.0\r\nbackports.functools-lru-cache==1.4\r\nbackports.shutil-get-terminal-size==1.0.0\r\nchardet==3.0.4\r\nconfigparser==4.0.2\r\ncontextlib2==0.6.0.post1\r\ncryptography==2.1.4\r\ncycler==0.10.0\r\ndecorator==4.1.2\r\ndistlib==0.3.0\r\nenum34==1.1.6\r\nfilelock==3.0.12\r\nfuncsigs==1.0.2\r\ngoogle-api-python-client==1.6.2\r\nh5py==2.7.1\r\nhttplib2==0.10.3\r\nidna==2.6\r\nimportlib-metadata==1.6.1\r\nimportlib-resources==2.0.1\r\nipaddress==1.0.17\r\nipython==5.5.0\r\nipython-genutils==0.2.0\r\nkeyring==10.6.0\r\nkeyrings.alt==3.0\r\nlz4==0.10.1\r\nmatplotlib==2.1.1\r\nmpmath==1.0.0\r\nnumpy==1.16.6\r\noauth2client==4.1.2\r\nolefile==0.45.1\r\npathlib2==2.3.5\r\npbr==5.4.5\r\npexpect==4.2.1\r\npickleshare==0.7.4\r\nPillow==5.1.0\r\npluggy==0.6.0\r\nprogressbar2==3.34.2\r\nprompt-toolkit==1.0.15\r\npy==1.5.2\r\npyasn1==0.3.2\r\npyasn1-modules==0.0.11\r\npycairo==1.16.2\r\npycrypto==2.6.1\r\nPygments==2.2.0\r\npygobject==3.26.1\r\nPyICU==1.9.8\r\nPyOpenGL==3.1.0\r\npyOpenSSL==17.5.0\r\npyparsing==2.2.0\r\nPySide==1.2.2\r\npytest==3.3.2\r\npython-dateutil==2.6.1\r\npython-lzo==1.8\r\npython-utils==2.2.0\r\npytz==2018.3\r\npyxdg==0.25\r\nrencode==1.0.5\r\nrsa==3.4.2\r\nscandir==1.10.0\r\nSecretStorage==2.3.1\r\nsimplegeneric==0.8.1\r\nsingledispatch==3.4.0.3\r\nsix==1.15.0\r\nstevedore==1.32.0\r\nsubprocess32==3.2.7\r\ntraitlets==4.3.2\r\ntyping==3.7.4.1\r\nuritemplate==3.0.0\r\nvirtualenv==20.0.23\r\nvirtualenv-clone==0.5.4\r\nvirtualenvwrapper==4.8.4\r\nwcwidth==0.1.7\r\nxpra==2.1.3\r\nyoutube-upload==0.8.0\r\nzipp==1.2.0\r\n\r\n```\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/EndCar808","@type":"Person","name":"EndCar808"},"datePublished":"2020-06-18T19:06:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/17673/matplotlib/issues/17673"}
| 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:e9c93ce7-82a4-e562-6d9b-490f589d52c9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E940:2D3512:1657CAF:1DA0CDF:6A52BACC |
| html-safe-nonce | b33a020b23126a7b39797298c23a7fd74f158da283574c43c26ee42959e34ce9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTQwOjJEMzUxMjoxNjU3Q0FGOjFEQTBDREY6NkE1MkJBQ0MiLCJ2aXNpdG9yX2lkIjoiNTE3MDcwMDQwNDkwNDg2ODU1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae158847c5469e4756749d9f68596ede11021421b42b708fde63a4f6b295fbf0 |
| hovercard-subject-tag | issue:641483939 |
| 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/17673/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ae9458f7f8814b5eacd099c1189ec8759e6e4e633422db77e47ba490ee5f439/matplotlib/matplotlib/issues/17673 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ae9458f7f8814b5eacd099c1189ec8759e6e4e633422db77e47ba490ee5f439/matplotlib/matplotlib/issues/17673 |
| og:image:alt | Bug report Bug summary Hi, I am working on a linux system which I do not have root privileges to. As such, I have created a virtual environment so I can use modules as I need without installing the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | EndCar808 |
| 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