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

Test failure for wcsaxes with 5.0rc1 on Debian/testing #12391

Closed
mhvk opened this issue Nov 3, 2021 · 4 comments
Closed

Test failure for wcsaxes with 5.0rc1 on Debian/testing #12391

mhvk opened this issue Nov 3, 2021 · 4 comments

Comments

@mhvk
Copy link
Contributor

mhvk commented Nov 3, 2021

After getting tests to run with #12389, I still get one failure (see below). It seems to boil down to my installation missing a particular latex style file (type1ec.sty). It would seem good to ensure that tests do not rely on this file, or abort gently if it is not present. I'm not sure how it is possible that normally tests pass fine, though!

platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-0.13.0

Running tests with Astropy version 5.0rc1.
Running tests in .local/lib/python3.9/site-packages/astropy.

Date: 2021-11-03T19:37:38

Platform: Linux-5.14.0-2-amd64-x86_64-with-glibc2.32

Executable: /usr/bin/python3

Full Python Version: 
3.9.7 (default, Sep 24 2021, 09:43:00) 
[GCC 10.3.0]

encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15

Package versions: 
Numpy: 1.19.5
Scipy: 1.7.1
Matplotlib: 3.3.4
h5py: 3.3.0
Pandas: 1.1.5
PyERFA: 2.0.0
Cython: 0.29.24
Scikit-image: not available
asdf: not available

Using Astropy options: remote_data: any.

rootdir: /home/mhvk
plugins: forked-1.3.0, xdist-2.4.0, mock-3.6.1, remotedata-0.3.2, openfiles-0.5.0, filter-subpackage-0.1.1, arraydiff-0.3, hypothesis-5.43.3, doctestplus-0.11.0, astropy-header-0.1.2, cov-2.12.1
.
.
.
_______________________________________ test_simplify_labels_usetex ________________________________________

self = <matplotlib.texmanager.TexManager object at 0x7f11ab3b6220>
command = ['latex', '-interaction=nonstopmode', '--halt-on-error', '/home/mhvk/.cache/matplotlib/tex.cache/1acea6f6c115d0ec7a634ed0529287b9.tex']
tex = 'lp'

    def _run_checked_subprocess(self, command, tex):
        _log.debug(cbook._pformat_subprocess(command))
        try:
>           report = subprocess.check_output(command,
                                             cwd=self.texcache,
                                             stderr=subprocess.STDOUT)

/usr/lib/python3/dist-packages/matplotlib/texmanager.py:275: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

timeout = None
popenargs = (['latex', '-interaction=nonstopmode', '--halt-on-error', '/home/mhvk/.cache/matplotlib/tex.cache/1acea6f6c115d0ec7a634ed0529287b9.tex'],)
kwargs = {'cwd': '/home/mhvk/.cache/matplotlib/tex.cache', 'stderr': -2}

    def check_output(*popenargs, timeout=None, **kwargs):
        r"""Run command with arguments and return its output.
    
        If the exit code was non-zero it raises a CalledProcessError.  The
        CalledProcessError object will have the return code in the returncode
        attribute and output in the output attribute.
    
        The arguments are the same as for the Popen constructor.  Example:
    
        >>> check_output(["ls", "-l", "/dev/null"])
        b'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'
    
        The stdout argument is not allowed as it is used internally.
        To capture standard error in the result, use stderr=STDOUT.
    
        >>> check_output(["/bin/sh", "-c",
        ...               "ls -l non_existent_file ; exit 0"],
        ...              stderr=STDOUT)
        b'ls: non_existent_file: No such file or directory\n'
    
        There is an additional optional argument, "input", allowing you to
        pass a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it too will be used internally.  Example:
    
        >>> check_output(["sed", "-e", "s/foo/bar/"],
        ...              input=b"when in the course of fooman events\n")
        b'when in the course of barman events\n'
    
        By default, all communication is in bytes, and therefore any "input"
        should be bytes, and the return value will be bytes.  If in text mode,
        any "input" should be a string, and the return value will be a string
        decoded according to locale encoding, or by "encoding" if set. Text mode
        is triggered by setting any of text, encoding, errors or universal_newlines.
        """
        if 'stdout' in kwargs:
            raise ValueError('stdout argument not allowed, it will be overridden.')
    
        if 'input' in kwargs and kwargs['input'] is None:
            # Explicitly passing input=None was previously equivalent to passing an
            # empty string. That is maintained here for backwards compatibility.
            if kwargs.get('universal_newlines') or kwargs.get('text'):
                empty = ''
            else:
                empty = b''
            kwargs['input'] = empty
    
>       return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
                   **kwargs).stdout

/usr/lib/python3.9/subprocess.py:424: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, capture_output = False, timeout = None, check = True
popenargs = (['latex', '-interaction=nonstopmode', '--halt-on-error', '/home/mhvk/.cache/matplotlib/tex.cache/1acea6f6c115d0ec7a634ed0529287b9.tex'],)
kwargs = {'cwd': '/home/mhvk/.cache/matplotlib/tex.cache', 'stderr': -2, 'stdout': -1}
process = <Popen: returncode: 1 args: ['latex', '-interaction=nonstopmode', '--halt-on...>
stdout = b"This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian) (preloaded format=latex)\n restricted \\w...ckage\n               {type1ec}^^M\nNo pages of output.\nTranscript written on 1acea6f6c115d0ec7a634ed0529287b9.log.\n"
stderr = None, retcode = 1

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '/home/mhvk/.cache/matplotlib/tex.cache/1acea6f6c115d0ec7a634ed0529287b9.tex']' returned non-zero exit status 1.

/usr/lib/python3.9/subprocess.py:528: CalledProcessError

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

ignore_matplotlibrc = None
tmpdir = local('/tmp/user/1000/pytest-of-mhvk/pytest-7/test_simplify_labels_usetex0')

    @pytest.mark.skipif('TEX_UNAVAILABLE')
    def test_simplify_labels_usetex(ignore_matplotlibrc, tmpdir):
        """Regression test for https://github.com/astropy/astropy/issues/8004."""
        plt.rc('text', usetex=True)
    
        header = {
            'NAXIS': 2,
            'NAXIS1': 360,
            'NAXIS2': 180,
            'CRPIX1': 180.5,
            'CRPIX2': 90.5,
            'CRVAL1': 180.0,
            'CRVAL2': 0.0,
            'CDELT1': -2 * np.sqrt(2) / np.pi,
            'CDELT2': 2 * np.sqrt(2) / np.pi,
            'CTYPE1': 'RA---MOL',
            'CTYPE2': 'DEC--MOL',
            'RADESYS': 'ICRS'}
    
        wcs = WCS(header)
        fig, ax = plt.subplots(
            subplot_kw=dict(frame_class=EllipticalFrame, projection=wcs))
        ax.set_xlim(-0.5, header['NAXIS1'] - 0.5)
        ax.set_ylim(-0.5, header['NAXIS2'] - 0.5)
        ax.coords[0].set_ticklabel(exclude_overlapping=True)
        ax.coords[1].set_ticklabel(exclude_overlapping=True)
        ax.coords[0].set_ticks(spacing=45 * u.deg)
        ax.coords[1].set_ticks(spacing=30 * u.deg)
        ax.grid()
    
>       fig.savefig(tmpdir / 'plot.png')

.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/tests/test_misc.py:477: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/matplotlib/figure.py:2311: in savefig
    self.canvas.print_figure(fname, **kwargs)
/usr/lib/python3/dist-packages/matplotlib/backend_bases.py:2210: in print_figure
    result = print_method(
/usr/lib/python3/dist-packages/matplotlib/backend_bases.py:1639: in wrapper
    return func(*args, **kwargs)
/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py:509: in print_png
    FigureCanvasAgg.draw(self)
/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py:407: in draw
    self.figure.draw(self.renderer)
/usr/lib/python3/dist-packages/matplotlib/artist.py:41: in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
/usr/lib/python3/dist-packages/matplotlib/figure.py:1863: in draw
    mimage._draw_list_compositing_images(
/usr/lib/python3/dist-packages/matplotlib/image.py:131: in _draw_list_compositing_images
    a.draw(renderer)
.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/core.py:456: in draw
    super().draw(renderer, **kwargs)
/usr/lib/python3/dist-packages/matplotlib/artist.py:41: in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
/usr/lib/python3/dist-packages/matplotlib/cbook/deprecation.py:411: in wrapper
    return func(*inner_args, **inner_kwargs)
/usr/lib/python3/dist-packages/matplotlib/axes/_base.py:2747: in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
/usr/lib/python3/dist-packages/matplotlib/image.py:131: in _draw_list_compositing_images
    a.draw(renderer)
.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/core.py:45: in draw
    self.axes.draw_wcsaxes(renderer)
.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/core.py:419: in draw_wcsaxes
    coord._draw_ticks(renderer, bboxes=self._bboxes,
.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/coordinate_helpers.py:601: in _draw_ticks
    self.ticklabels.draw(renderer, bboxes=bboxes,
.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/ticklabels.py:259: in draw
    self._set_xy_alignments(renderer, tick_out_size)
.local/lib/python3.9/site-packages/astropy/visualization/wcsaxes/ticklabels.py:189: in _set_xy_alignments
    bb = super().get_window_extent(renderer)
/usr/lib/python3/dist-packages/matplotlib/text.py:902: in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
/usr/lib/python3/dist-packages/matplotlib/text.py:287: in _get_layout
    _, lp_h, lp_d = renderer.get_text_width_height_descent(
/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py:227: in get_text_width_height_descent
    w, h, d = texmanager.get_text_width_height_descent(
/usr/lib/python3/dist-packages/matplotlib/texmanager.py:423: in get_text_width_height_descent
    dvifile = self.make_dvi(tex, fontsize)
/usr/lib/python3/dist-packages/matplotlib/texmanager.py:309: in make_dvi
    self._run_checked_subprocess(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <matplotlib.texmanager.TexManager object at 0x7f11ab3b6220>
command = ['latex', '-interaction=nonstopmode', '--halt-on-error', '/home/mhvk/.cache/matplotlib/tex.cache/1acea6f6c115d0ec7a634ed0529287b9.tex']
tex = 'lp'

    def _run_checked_subprocess(self, command, tex):
        _log.debug(cbook._pformat_subprocess(command))
        try:
            report = subprocess.check_output(command,
                                             cwd=self.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 report generated by {prog}:\n'
                '{exc}\n\n'.format(
                    prog=command[0],
                    tex=tex.encode('unicode_escape'),
                    exc=exc.output.decode('utf-8'))) from exc
E           RuntimeError: latex was not able to process the following string:
E           b'lp'
E           
E           Here is the full report generated by latex:
E           This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian) (preloaded format=latex)
E            restricted \write18 enabled.
E           entering extended mode
E           (/home/mhvk/.cache/matplotlib/tex.cache/1acea6f6c115d0ec7a634ed0529287b9.tex
E           LaTeX2e <2021-06-01> patch level 1
E           L3 programming layer <2021-08-27>
E           (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
E           Document Class: article 2021/02/12 v1.4n 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.6 \usepackage
E                          {type1ec}^^M
E           No pages of output.
E           Transcript written on 1acea6f6c115d0ec7a634ed0529287b9.log.

/usr/lib/python3/dist-packages/matplotlib/texmanager.py:283: RuntimeError
@mhvk mhvk added this to the v5.0 milestone Nov 3, 2021
@astrofrog
Copy link
Member

This is a Matplotlib issue - in fact it is in the documentation that you need to install cm-super:

https://matplotlib.org/stable/devel/dependencies.html#font-handling-and-rendering

But I think it should probably be made more prominent - see matplotlib/matplotlib#17675.

In any case, I don't think it's something we should fix here. I'll leave this open for a couple of days in case you disagree!

@github-actions
Copy link

github-actions bot commented Nov 5, 2021

Hi humans 👋 - this issue was labeled as Close? approximately 19 hours ago. If you think this issue should not be closed, a maintainer should remove the Close? label - otherwise, I will close this issue in 7 days.

If you believe I commented on this issue incorrectly, please report this here

@astrofrog
Copy link
Member

@mhvk - are you happy for this to be closed given my previous comment?

@mhvk mhvk removed this from the v5.0 milestone Nov 5, 2021
@mhvk
Copy link
Contributor Author

mhvk commented Nov 5, 2021

Thanks for following this up! I don't really like how matplotlib has this "hidden" dependency, but presumably Debian will change its setup accordingly at some point. In any case, it doesn't feel like we can do much about it, so let's close.

@mhvk mhvk closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants