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

Latex error on CI #1148

Closed
avivajpeyi opened this issue Jun 21, 2024 · 5 comments
Closed

Latex error on CI #1148

avivajpeyi opened this issue Jun 21, 2024 · 5 comments
Assignees
Labels
bug Something isn't working urgency_moderate This is a moderately urgent issue

Comments

@avivajpeyi
Copy link
Collaborator

Latex is not being found on the CI yet again...

From Ilya:

I am still getting e-mails like this when I submit PRs. As far as I can tell, they are because of latex issues. Can we modify the plot labels to not use latex, even if that makes them uglier?

>               raise child_exception_type(errno_num, err_msg, err_filename)
E               FileNotFoundError: [Errno 2] No such file or directory: 'latex'

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/subprocess.py:1837: FileNotFoundError

The above exception was the direct cause of the following exception:

example_compas_output_path = '/home/runner/work/COMPAS/COMPAS/py_tests/test_data/COMPAS_Output/COMPAS_Output.h5'
capsys = <_pytest.capture.CaptureFixture object at 0x7f65aa30dd30>
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:14: 
....

cls = <class 'matplotlib.texmanager.TexManager'>
command = ['latex', '-interaction=nonstopmode', '--halt-on-error', '--output-directory=tmp70z5_fwk', 'd9a3c38ae9dd21d7e595745c50e22975.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(
                f'Failed to process string with tex because {command[0]} '
                'could not be found') from exc
E           RuntimeError: Failed to process string with tex because latex could not be found

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/matplotlib/texmanager.py:254: RuntimeError

This is not the first time this issue has occurred.
#960
#990
#1087

We could try this:

def safe_save_figure(fig, filename, **kwargs):
    check_directory_exists_and_if_not_mkdir(os.path.dirname(filename))
    from matplotlib import rcParams

    try:
        fig.savefig(fname=filename, **kwargs)
    except RuntimeError:
        logger.debug("Failed to save plot with tex labels turning off tex.")
        rcParams["text.usetex"] = False
        fig.savefig(fname=filename, **kwargs)
@ilyamandel
Copy link
Collaborator

Unrelated issue, but suggest fixing both at once:

We use example_bbh_compas_config to produce a BBH for testing. However, when options change, developers update compasConfigDefault.yaml and generally forget to update compasConfigDefault.yaml.

I suggest changing the process a bit to use compasConfigDefault.yaml (default settings) but only over-write the initial conditions (see example_bbh_compas_config) as command-line arguments when testing.

@ilyamandel
Copy link
Collaborator

@avivajpeyi , this one is still a CI issue; hopefully, one can solve it by adding a non-latex compilation option to be used during CI.

@ilyamandel
Copy link
Collaborator

Although now it claims that the problem is with pip install ?!!

https://github.com/TeamCOMPAS/COMPAS/actions/runs/10127588141/job/28005563943

@ilyamandel
Copy link
Collaborator

@avivajpeyi , @reinhold-willcox -- ping on these CI issues...

@ilyamandel ilyamandel added bug Something isn't working urgency_moderate This is a moderately urgent issue labels Aug 22, 2024
@ilyamandel
Copy link
Collaborator

Closing after #1191 , #1192 -- thank you, @avivajpeyi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgency_moderate This is a moderately urgent issue
Projects
None yet
Development

No branches or pull requests

2 participants