[MacPorts] #64173: py39-matplotlib @3.5.0_1 breaks saving a figure to PDF

MacPorts noreply at macports.org
Fri Dec 10 00:12:08 UTC 2021


#64173: py39-matplotlib @3.5.0_1 breaks saving a figure to PDF
---------------------+---------------------------
 Reporter:  aaronm6  |      Owner:  (none)
     Type:  defect   |     Status:  new
 Priority:  Normal   |  Milestone:
Component:  ports    |    Version:  2.7.1
 Keywords:           |       Port:  py-matplotlib
---------------------+---------------------------
 (sorry to post a new ticket so soon, Renee!  Thanks for all your hard
 work!)
 Saving a figure as PNG works fine with `py39-matplotlib @3.5.0_1`.
 However, saving it as PDF causes an import error this time related to
 `fontTools`.  Hopefully this is a simple update to the dependencies.

 **Installing `py39-fonttools @4.28.3` fixes this problem**

 {{{
 Python 3.9.9 (main, Nov 16 2021, 07:33:57)
 [Clang 12.0.5 (clang-1205.0.22.11)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> from matplotlib import pyplot as plt
 >>> plt.figure()
 <Figure size 1280x960 with 0 Axes>
 >>> plt.plot([1,2,3],'.')
 [<matplotlib.lines.Line2D object at 0x12d740d60>]
 >>> plt.gcf().savefig('myplot.png',format='png')  # <---- this works
 >>> plt.gcf().savefig('myplot.pdf',format='pdf')  # <---- this does not
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /site-packages/matplotlib/figure.py", line 3012, in savefig
     self.canvas.print_figure(fname, **kwargs)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /site-packages/matplotlib/backend_bases.py", line 2254, in print_figure
     canvas = self._get_output_canvas(backend, format)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /site-packages/matplotlib/backend_bases.py", line 2179, in
 _get_output_canvas
     canvas_class = get_registered_canvas_class(fmt)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /site-packages/matplotlib/backend_bases.py", line 144, in
 get_registered_canvas_class
     backend_class = importlib.import_module(backend_class).FigureCanvas
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py",
 line 127, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
   File "<frozen importlib._bootstrap>", line 986, in
 _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
   File "<frozen importlib._bootstrap>", line 228, in
 _call_with_frames_removed
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /site-packages/matplotlib/backends/backend_pdf.py", line 47, in <module>
     from . import _backend_pdf_ps
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /site-packages/matplotlib/backends/_backend_pdf_ps.py", line 8, in
 <module>
     from fontTools import subset
 ModuleNotFoundError: No module named 'fontTools'
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/64173>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list