Skip to content
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

matploltib latex error with plot_detailed_evolution: type1ec missing #989

Closed
avivajpeyi opened this issue Aug 7, 2023 · 5 comments
Closed

Comments

@avivajpeyi
Copy link
Collaborator

avivajpeyi commented Aug 7, 2023

example_compas_output_path = '/home/runner/work/COMPAS/COMPAS/py_tests/../misc/examples/methods_paper_plots/detailed_evolution/COMPAS_Output/COMPAS_Output.h5'
capsys = <_pytest.capture.CaptureFixture object at 0x7f2580b09580>
test_archive_dir = '/home/runner/work/COMPAS/COMPAS/py_tests/test_artifacts'

    def test_plotter(example_compas_output_path, capsys, test_archive_dir):
        data_path = example_compas_output_path
        bse_detailed_out_path = os.path.join(
            os.path.dirname(data_path), "Detailed_Output/BSE_Detailed_Output_0.h5"
        )
        t0 = time.time()
>       plot_detailed_evolution.run_main_plotter(
            bse_detailed_out_path, outdir=test_archive_dir, show=False
        )

py_tests/test_plot_detailed_evolution.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
compas_python_utils/detailed_evolution_plotter/plot_detailed_evolution.py:38: in run_main_plotter
    makeDetailedPlots(Data, events, outdir=outdir)
compas_python_utils/detailed_evolution_plotter/plot_detailed_evolution.py:116: in makeDetailedPlots
    fig.tight_layout(h_pad=1, w_pad=1, rect=(0.08, 0.08, .98, .98), pad=0.)  # (left, bottom, right, top)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/figure.py:[35](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:36)44: in tight_layout
    engine.execute(self)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/layout_engine.py:184: in execute
    kwargs = get_tight_layout_figure(
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/_tight_layout.py:266: in get_tight_layout_figure
    kwargs = _auto_adjust_subplotpars(fig, renderer,
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/_tight_layout.py:82: in _auto_adjust_subplotpars
    bb += [martist._get_tightbbox_for_layout_only(ax, renderer)]
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/artist.py:1415: in _get_tightbbox_for_layout_only
    return obj.get_tightbbox(*args, **{**kwargs, "for_layout_only": True})
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/axes/_base.py:4385: in get_tightbbox
    ba = martist._get_tightbbox_for_layout_only(axis, renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/artist.py:1415: in _get_tightbbox_for_layout_only
    return obj.get_tightbbox(*args, **{**kwargs, "for_layout_only": True})
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/axis.py:1325: in get_tightbbox
    self._update_label_position(renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/axis.py:2304: in _update_label_position
    bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/axis.py:2100: in _get_tick_boxes_siblings
    tlb, tlb2 = axis._get_ticklabel_bboxes(ticks_to_draw, renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/axis.py:1304: in _get_ticklabel_bboxes
    return ([tick.label1.get_window_extent(renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/axis.py:1304: in <listcomp>
    return ([tick.label1.get_window_extent(renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/text.py:959: in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/text.py:378: in _get_layout
    _, lp_h, lp_d = _get_text_metrics_with_cache(
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/text.py:97: in _get_text_metrics_with_cache
    return _get_text_metrics_with_cache_impl(
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/text.py:105: in _get_text_metrics_with_cache_impl
    return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py:226: in get_text_width_height_descent
    return super().get_text_width_height_descent(s, prop, ismath)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/backend_bases.py:645: in get_text_width_height_descent
    return self.get_texmanager().get_text_width_height_descent(
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/texmanager.py:[36](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:37)8: in get_text_width_height_descent
    dvifile = cls.make_dvi(tex, fontsize)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/texmanager.py:300: in make_dvi
    cls._run_checked_subprocess(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'matplotlib.texmanager.TexManager'>
command = ['latex', '-interaction=nonstopmode', '--halt-on-error', '--output-directory=tmp2fs_p1lc', '574b56a74699b34bb0ed5083ffe19a26.tex']
tex = 'lp'

    @classmethod
    def _run_checked_subprocess(cls, command, tex, *, cwd=None):
        _log.debug(cbook._pformat_subprocess(command))
        try:
            report = subprocess.check_output(
                command, cwd=cwd if cwd is not None else cls.texcache,
                stderr=subprocess.STDOUT)
        except FileNotFoundError as exc:
            raise RuntimeError(
                'Failed to process string with tex because {} could not be '
                'found'.format(command[0])) from exc
        except subprocess.CalledProcessError as exc:
>           raise RuntimeError(
                '{prog} was not able to process the following string:\n'
                '{tex!r}\n\n'
                'Here is the full command invocation and its output:\n\n'
                '{format_command}\n\n'
                '{exc}\n\n'.format(
                    prog=command[0],
                    format_command=cbook._pformat_subprocess(command),
                    tex=tex.encode('unicode_escape'),
                    exc=exc.output.decode('utf-8', 'backslashreplace'))
                ) from None
E           RuntimeError: latex was not able to process the following string:
E           b'lp'
E           
E           Here is the full command invocation and its output:
E           
E           latex -interaction=nonstopmode --halt-on-error --output-directory=tmp2fs_p1lc 574b56a74699b34bb0ed5083ffe19a26.tex
E           
E           This is pdfTeX, Version 3.14159265-2.6-1.[40](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:41).20 (TeX Live 2019/Debian) (preloaded format=latex)
E            restricted \write18 enabled.
E           entering extended mode
E           (./574b56a7[46](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:47)99b34bb0ed[50](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:51)83ffe19a26.tex
E           LaTeX2e <2020-02-02> patch level 2
E           L3 programming layer <2020-02-14>
E           (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
E           Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
E           (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
E           (/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)
E           
E           ! LaTeX Error: File `type1ec.sty' not found.
E           
E           Type X to quit or <RETURN> to proceed,
E           or enter new name. (Default extension: sty)
E           
E           Enter file name: 
E           ! Emergency stop.
E           <read *> 
E                    
E           l.9 \usepackage
E                          [utf8]{inputenc}^^M
E           No pages of output.
E           Transcript written on tmp2fs_p1lc/574b[56](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:57)a74699b34bb0ed5083ffe19a26.log.

/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/matplotlib/texmanager.py:2[63](https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283#step:7:64): RuntimeError

https://github.com/TeamCOMPAS/COMPAS/actions/runs/5773781649/job/15661136283

Maybe related to
matplotlib/matplotlib#16911

@avivajpeyi avivajpeyi changed the title matploltib latex error: type1ec missing matploltib latex error with plot_detailed_evolution: type1ec missing Aug 7, 2023
@avivajpeyi
Copy link
Collaborator Author

This passes on my local machine... arggg

@avivajpeyi
Copy link
Collaborator Author

Error was on the latex install on the gitub-action runner CI. Fixed by github.

@avivajpeyi
Copy link
Collaborator Author

Nope, not fixed. I think we need to install/add and cache latex to the runner? Why is this not an issue with other py packages?

@ilyamandel
Copy link
Collaborator

@avivajpeyi -- if this issue can't be resolved (i.e., we are giving up on github making these plots as part of CI), should we close it?

@avivajpeyi
Copy link
Collaborator Author

Hey @ilyamandel -- i managed to fix this (hopefully for good!) in #1087

For example, see your latest PR's plot here
https://github.com/TeamCOMPAS/COMPAS/actions/runs/8963036295
Screenshot from 2024-05-06 14-45-51
Screenshot from 2024-05-06 14-45-01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants