Bug 1914285 - python-mplcairo: FTBFS in Fedora rawhide: RuntimeWarning: divide by zero encountered in log10
Summary: python-mplcairo: FTBFS in Fedora rawhide: RuntimeWarning: divide by zero enco...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: python-mplcairo
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Elliott Sales de Andrade
QA Contact: Fedora Extras Quality Assurance
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On: 1921574
Blocks: F34FTBFS PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-01-08 14:27 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 16:25 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-01-08 14:27:28 UTC
Description of problem:
Package python-mplcairo fails to build from source in Fedora rawhide.

Version-Release number of selected component (if applicable):
0.3-4.fc33

Steps to Reproduce:
koji build --scratch f34 python-mplcairo-0.3-4.fc33.src.rpm

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/python-mplcairo

=================================== FAILURES ===================================
____________________________ test_specgram_fs_none _____________________________
[gw4] linux -- Python 3.9.1 /usr/bin/python3
    def test_specgram_fs_none():
        """Test axes.specgram when Fs is None, should not throw error."""
>       spec, freqs, t, im = plt.specgram(np.ones(300), Fs=None)
/usr/lib64/python3.9/site-packages/matplotlib/tests/test_axes.py:4155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.9/site-packages/matplotlib/pyplot.py:2919: in specgram
    __ret = gca().specgram(
/usr/lib64/python3.9/site-packages/matplotlib/__init__.py:1427: in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <AxesSubplot:>
x = array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
       1., 1., 1., 1., 1., 1., 1., 1., 1., ...1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
       1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])
NFFT = 256, Fs = 2, Fc = 0, detrend = None, window = None, noverlap = 128
cmap = None, xextent = None, pad_to = None, sides = None, scale_by_freq = None
mode = None, scale = 'dB', vmin = None, vmax = None, kwargs = {}
spec = array([[8.50000000e+01],
       [4.29996400e+01],
       [2.96562495e-04],
       [4.15570832e-05],
       [1.18056850... [1.45740501e-13],
       [8.18349917e-14],
       [3.63254653e-14],
       [9.07452846e-15],
       [0.00000000e+00]])
freqs = array([0.       , 0.0078125, 0.015625 , 0.0234375, 0.03125  , 0.0390625,
       0.046875 , 0.0546875, 0.0625   , 0.070...6875,
       0.9375   , 0.9453125, 0.953125 , 0.9609375, 0.96875  , 0.9765625,
       0.984375 , 0.9921875, 1.       ])
t = array([64.])
    @_preprocess_data(replace_names=["x"])
    @docstring.dedent_interpd
    def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
                 window=None, noverlap=None,
                 cmap=None, xextent=None, pad_to=None, sides=None,
                 scale_by_freq=None, mode=None, scale=None,
                 vmin=None, vmax=None, **kwargs):
        """
        Plot a spectrogram.
    
        Compute and plot a spectrogram of data in *x*.  Data are split into
        *NFFT* length segments and the spectrum of each section is
        computed.  The windowing function *window* is applied to each
        segment, and the amount of overlap of each segment is
        specified with *noverlap*. The spectrogram is plotted as a colormap
        (using imshow).
    
        Parameters
        ----------
        x : 1-D array or sequence
            Array or sequence containing the data.
    
        %(Spectral)s
    
        %(PSD)s
    
        mode : {'default', 'psd', 'magnitude', 'angle', 'phase'}
            What sort of spectrum to use.  Default is 'psd', which takes the
            power spectral density.  'magnitude' returns the magnitude
            spectrum.  'angle' returns the phase spectrum without unwrapping.
            'phase' returns the phase spectrum with unwrapping.
    
        noverlap : int
            The number of points of overlap between blocks.  The
            default value is 128.
    
        scale : {'default', 'linear', 'dB'}
            The scaling of the values in the *spec*.  'linear' is no scaling.
            'dB' returns the values in dB scale.  When *mode* is 'psd',
            this is dB power (10 * log10).  Otherwise this is dB amplitude
            (20 * log10). 'default' is 'dB' if *mode* is 'psd' or
            'magnitude' and 'linear' otherwise.  This must be 'linear'
            if *mode* is 'angle' or 'phase'.
    
        Fc : int, default: 0
            The center frequency of *x*, which offsets the x extents of the
            plot to reflect the frequency range used when a signal is acquired
            and then filtered and downsampled to baseband.
    
        cmap : `.Colormap`, default: :rc:`image.cmap`
    
        xextent : *None* or (xmin, xmax)
            The image extent along the x-axis. The default sets *xmin* to the
            left border of the first bin (*spectrum* column) and *xmax* to the
            right border of the last bin. Note that for *noverlap>0* the width
            of the bins is smaller than those of the segments.
    
        **kwargs
            Additional keyword arguments are passed on to `~.axes.Axes.imshow`
            which makes the specgram image.
    
        Returns
        -------
        spectrum : 2-D array
            Columns are the periodograms of successive segments.
    
        freqs : 1-D array
            The frequencies corresponding to the rows in *spectrum*.
    
        t : 1-D array
            The times corresponding to midpoints of segments (i.e., the columns
            in *spectrum*).
    
        im : `.AxesImage`
            The image created by imshow containing the spectrogram.
    
        See Also
        --------
        psd
            Differs in the default overlap; in returning the mean of the
            segment periodograms; in not returning times; and in generating a
            line plot instead of colormap.
        magnitude_spectrum
            A single spectrum, similar to having a single segment when *mode*
            is 'magnitude'. Plots a line instead of a colormap.
        angle_spectrum
            A single spectrum, similar to having a single segment when *mode*
            is 'angle'. Plots a line instead of a colormap.
        phase_spectrum
            A single spectrum, similar to having a single segment when *mode*
            is 'phase'. Plots a line instead of a colormap.
    
        Notes
        -----
        The parameters *detrend* and *scale_by_freq* do only apply when *mode*
        is set to 'psd'.
        """
        if NFFT is None:
            NFFT = 256  # same default as in mlab.specgram()
        if Fc is None:
            Fc = 0  # same default as in mlab._spectral_helper()
        if noverlap is None:
            noverlap = 128  # same default as in mlab.specgram()
        if Fs is None:
            Fs = 2  # same default as in mlab._spectral_helper()
    
        if mode == 'complex':
            raise ValueError('Cannot plot a complex specgram')
    
        if scale is None or scale == 'default':
            if mode in ['angle', 'phase']:
                scale = 'linear'
            else:
                scale = 'dB'
        elif mode in ['angle', 'phase'] and scale == 'dB':
            raise ValueError('Cannot use dB scale with angle or phase mode')
    
        spec, freqs, t = mlab.specgram(x=x, NFFT=NFFT, Fs=Fs,
                                       detrend=detrend, window=window,
                                       noverlap=noverlap, pad_to=pad_to,
                                       sides=sides,
                                       scale_by_freq=scale_by_freq,
                                       mode=mode)
    
        if scale == 'linear':
            Z = spec
        elif scale == 'dB':
            if mode is None or mode == 'default' or mode == 'psd':
>               Z = 10. * np.log10(spec)
E               RuntimeWarning: divide by zero encountered in log10
/usr/lib64/python3.9/site-packages/matplotlib/axes/_axes.py:7553: RuntimeWarning

Comment 1 Fedora Release Engineering 2021-01-24 04:22:40 UTC
Dear Maintainer,

your package has an open Fails To Build From Source bug for Fedora 34.
Action is required from you.

If you can fix your package to build, perform a build in koji, and either create
an update in bodhi, or close this bug without creating an update, if updating is
not appropriate [1]. If you are working on a fix, set the status to ASSIGNED to
acknowledge this. If you have already fixed this issue, please close this Bugzilla report.

Following the policy for such packages [2], your package will be orphaned if
this bug remains in NEW state more than 8 weeks (not sooner than 2021-03-05).

A week before the mass branching of Fedora 35 according to the schedule [3],
any packages not successfully rebuilt at least on Fedora 33 will be
retired regardless of the status of this bug.

[1] https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/
[2] https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/
[3] https://fedorapeople.org/groups/schedule/f-35/f-35-key-tasks.html

Comment 2 Elliott Sales de Andrade 2021-02-06 01:49:45 UTC
This would have been fixed by latest Matplotlib, but appears to have broken due to Python 3.9.1 and/or pybind11 incompatibility.

+ /usr/bin/python3 -c 'import mplcairo.base'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/builddir/build/BUILDROOT/python-mplcairo-0.3-5.fc34.x86_64/usr/lib64/python3.9/site-packages/mplcairo/__init__.py", line 20, in <module>
    from . import _mplcairo
ImportError: Object of type 'EnumMeta' is not an instance of 'none'

Comment 3 Ben Cotton 2021-02-09 15:38:28 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.