New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MathTex Font error #5208
Comments
Have you tried deleting the font cache in ~/.matplotlib? |
I have the same issue seemingly at random whenever "complex" text is involved. Clearing the cache (in This behavior is the same for me: "Re-executing the same cell many times I get the error most of the time and the correct plot sometimes." except that I don't re-execute the cell, but re-display inside a loop using IPython's Note that if I stop the cell while this happens, then any other plotting which involves "complex" text will fail. For example, Here's the full, long backtrace:
|
I believe I found the cause, but not the origin, of the error: Once this error starts occurring, many other operations which involve files (even So my guess is that something somewhere during plotting opens a file without closing it. It may be anything, probably grepping matplotlib's code using some pattern looking for occurrences of So a workaround until someone finds and fixes the offending |
This is likely resolved by #5295 which will be in matplotlib 2.0 |
I have encounter exactly the same issue in matplotlib v1.5 under Mac OS X /Some/Path/To/lib/python3.5/site-packages/matplotlib/mathtext.py in __init__(self, default_font_prop, mathtext_backend)
564
565 filename = findfont(default_font_prop)
--> 566 default_font = self.CachedFont(FT2Font(filename))
567 self._fonts['default'] = default_font
568 self._fonts['regular'] = default_font
TypeError: First argument must be a path or file object reading bytes It seems I have plotted too many figures but not had them released. fig, (ax1, ax2) = plt.subplots(2, sharex=True, figsize=(width, 10))
# some plot with the ax
# ...
# when done plot, close the fig to release resources
plt.close(fig) |
Same bug using Jupyter notebook. Does not crash systematically. |
Also seeing this idiosyncratically when saving plots as pngs:
Only seems to occur when repeatedly calling the same plot with differing arguments, removing macOS |
Likely closed by #5295 (there is no report using mpl 2.0) so closing, but please request a reopen if not. |
I am getting the same issue using jupyter notebook, so what's the solution is? |
1.5.0rc3 is quite old. Do you have this issue on a more modern Matplotlib? |
Matplotlib 1.5.1rc1 (from conda repo)
seaborn 0.6
Anaconda
python 3.4
notebook 4.0.5
Mac OS X
backend inline
Plotting a figure with a bunch of mathtex formulas results in an error. Re-executing the same cell many times I get the error most of the time and the correct plot sometimes.
The stack trace is very long and termitates with:
The plotting code is something like this:
And when it succeeds it generates a plot like this:
I'll update the issue if I can create a standalone example.
xref: maybe related to #3086
The text was updated successfully, but these errors were encountered: