I recently got a new laptop with Mac OS Sonoma 14.2.1, to which I migrated the data from my Big Sur laptop via TimeMachine. I updated Xcode and then followed the MacPorts instructions for migration (https://trac.macports.org/wiki/Migration). I also updated gcc to gcc 13.2 (https://github.com/fxcoudert/gfortran-for-macOS/releases), fortran code compiles fine.
The issue: matplotlib does not plot when using Tex. I get the following output:
In [1]: p.plot([0,1],[0,1]) Installed osx event loop hook. Out[1]: [<matplotlib.lines.Line2D at 0x16a8c70d0>] In [2]: PANIC: unprotected error in call to Lua API (zlib library version does not match - header: 1.3, library: 1.3.1) Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 1226, in _on_timer ret = func(*args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py", line 68, in callback_func callback() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py", line 88, in _draw_idle self.draw() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py", line 50, in draw super().draw() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 400, in draw self.figure.draw(self.renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/artist.py", line 95, in draw_wrapper result = draw(artist, renderer, *args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/figure.py", line 3175, in draw mimage._draw_list_compositing_images( File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images a.draw(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 3064, in draw mimage._draw_list_compositing_images( File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images a.draw(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axis.py", line 1389, in draw tlb1, tlb2 = self._get_ticklabel_bboxes(ticks_to_draw, renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axis.py", line 1316, in _get_ticklabel_bboxes return ([tick.label1.get_window_extent(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/axis.py", line 1316, in <listcomp> return ([tick.label1.get_window_extent(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/text.py", line 959, in get_window_extent bbox, info, descent = self._get_layout(self._renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/text.py", line 378, in _get_layout _, lp_h, lp_d = _get_text_metrics_with_cache( File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/text.py", line 97, in _get_text_metrics_with_cache return _get_text_metrics_with_cache_impl( File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/text.py", line 105, in _get_text_metrics_with_cache_impl return renderer_ref().get_text_width_height_descent(text, fontprop, ismath) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 226, in get_text_width_height_descent return super().get_text_width_height_descent(s, prop, ismath) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 645, in get_text_width_height_descent return self.get_texmanager().get_text_width_height_descent( File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/texmanager.py", line 371, in get_text_width_height_descent page, = dvi File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 296, in __iter__ while self._read(): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 375, in _read self._dtable[byte](self, byte) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 227, in wrapper return method(self, *[f(self, byte-min) for f in get_args]) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 526, in _fnt_def self._fnt_def_real(k, c, s, d, a, l) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 531, in _fnt_def_real tfm = _tfmfile(fontname) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 1132, in _fontfile return cls(_find_tex_file(texname + suffix)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/dviread.py", line 1110, in _find_tex_file raise FileNotFoundError( FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'cmss10.tfm' in your texmf tree, but could not find itThe texmf tree is present in /opt/local/share/texmf-texlive/fonts/tfm. Running kpsewhich cmss10.tfm in the terminal gives the correct path. However, matplotlib.dviread can't find it.
I have explicitly put export TEXMFHOME=/opt/local/share/texmf-texlive/fonts/tfm and export TEXMFLOCAL=/opt/local/share/texmf-texlive/fonts/tfm in the bash_profile, this does not solve the issue. Plotting worked fine before updating Xcode and migrating macports...
Does anyone have any ideas to solve this issue? Thanks in advance!