Sphinx build fails on fedora:rawhide
baumeier opened this issue · comments
In the CI all Sphinx builds fail with some matplotlib/seaborn error, for example here
Fedora:rawhide currently comes with matplotlib 3.6.0rc2
. Downgrading to version 3.5
removes the build failure. I am not sure if that is an intended change in version 3.6 that clashes with the current seaborn version.
@tylerjereddy any ideas? Or do you know somebody who would know?
Can try pinging the matplotlib
project lead @tacaswell or maybe @QuLogic. I think the stable release of 3.6.0
is out now, so that might be worth trying vs. rc2
at this point.
The bottom of the traceback shows an actual AttributeError
. It looks like this may be coming from a Jupyter notebook or something--splitting out a smaller/isolated reproducer/code block might be useful if you want upstream to investigate.
File /usr/lib64/python3.11/site-packages/matplotlib/pyplot.py:775, in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, clear, **kwargs)
762 _api.warn_external(
763 f"More than {max_open_warning} figures have been opened. "
764 f"Figures created through the pyplot interface "
(...)
768 f"Consider using `matplotlib.pyplot.close()`.",
769 RuntimeWarning)
771 manager = new_figure_manager(
772 num, figsize=figsize, dpi=dpi,
773 facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
774 FigureClass=FigureClass, **kwargs)
--> 775 fig = manager.canvas.figure
776 if fig_label:
777 fig.set_label(fig_label)
AttributeError: 'NoneType' object has no attribute 'canvas'
AttributeError: 'NoneType' object has no attribute 'canvas'
Which backend are you using? Please test with the 3.6.0 release.
This is on fedora:rawhide
, let me retrigger our CI container build to get matplotlib-3.6.0!
@baumeier the Cron job last night already pulled in v3.6.0, can you give it another try?
@junghans Simple re-start of the failed had the same issue. Or do I need to start an all new CI cycle so that a new container is pulled?
By backend he probably means matplotlib backend like Agg or qtagg; effectively the workhorse that does the actual plotting under the hood. Maybe I can look at the notebook if you’re not sure.
@baumeier a simple retrigger should do it! Can you check the version?
Crudely trying to reproduce the example, removing the votca
parts, doesn't produce an error with various backends in my hands:
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("Agg") # or nbAgg, etc.
import matplotlib.pyplot as plt
import seaborn as sns
data = np.zeros(shape=(200, 2))
data[..., 1] = 1
df = pd.DataFrame.from_records(data)
df.columns = ["x", "y"]
p = sns.relplot(x="x", y="y", ci=None, kind="line", data=df)
plt.plot()
plt.savefig("out.png")
It does produce a warning however:
/home/tyler/py310_votca_work/lib/python3.10/site-packages/seaborn/axisgrid.py:848: FutureWarning:
The `ci` parameter is deprecated. Use `errorbar=None` for the same effect.
func(*plot_args, **plot_kwargs)
That warning shows up even with matplotlib
3.5 though. You're also using Python 3.11
, hopefully one of the RC versions so it is ABI stable with the release in a few weeks. I wouldn't think that would be a problem.
The broader context looks like some kind of complicated nbconvert
command? Not sure what complications that might add.
you might want to try the suggestion from the warning as well if there's anything in the workflow that might change warnings into errors
Hmm, it still persists:
[NbConvertApp] msg_type: status
[NbConvertApp] content: {'execution_state': 'idle'}
[NbConvertApp] Destroying zmq context for <jupyter_client.asynchronous.client.AsyncKernelClient object at 0x7f1e5a444850>
Traceback (most recent call last):
File "/usr/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.11/site-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/traitlets/config/application.py", line 978, in launch_instance
app.start()
File "/usr/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 423, in start
self.convert_notebooks()
File "/usr/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 560, in convert_single_notebook
output, resources = self.export_single_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 488, in export_single_notebook
output, resources = self.exporter.from_filename(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 189, in from_filename
return self.from_file(f, resources=resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 206, in from_file
return self.from_notebook_node(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/exporters/notebook.py", line 35, in from_notebook_node
nb_copy, resources = super().from_notebook_node(nb, resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 146, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 335, in _preprocess
nbc, resc = preprocessor(nbc, resc)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb, resources)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py", line 89, in preprocess
self.preprocess_cell(cell, resources, index)
File "/usr/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py", line 110, in preprocess_cell
cell = self.execute_cell(cell, index, store_history=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbclient/util.py", line 85, in wrapped
return just_run(coro(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbclient/util.py", line 60, in just_run
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/asyncio/base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/nbclient/client.py", line 1025, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/usr/lib/python3.11/site-packages/nbclient/client.py", line 919, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
columns = ["logJ2", "counts"]
df = pd.read_table("ianalyze.ihist_h.out", comment="#", sep='\s+',names=columns, skiprows=2)
sns.relplot(x="logJ2", y="counts", ci=None, kind="line", data=df)
plt.plot()
------------------
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [7], line 3
1 columns = ["logJ2", "counts"]
2 df = pd.read_table("ianalyze.ihist_h.out", comment="#", sep='\s+',names=columns, skiprows=2)
----> 3 sns.relplot(x="logJ2",y="counts",ci=None,kind="line",data=df)
4 plt.plot()
File /usr/lib/python3.11/site-packages/seaborn/_decorators.py:46, in _deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
36 warnings.warn(
37 "Pass the following variable{} as {}keyword arg{}: {}. "
38 "From version 0.12, the only valid positional argument "
(...)
43 FutureWarning
44 )
45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46 return f(**kwargs)
File /usr/lib/python3.11/site-packages/seaborn/relational.py:1027, in relplot(x, y, hue, size, style, data, row, col, col_wrap, row_order, col_order, palette, hue_order, hue_norm, sizes, size_order, size_norm, markers, dashes, style_order, legend, kind, height, aspect, facet_kws, units, **kwargs)
1025 # Set up the FacetGrid object
1026 facet_kws = {} if facet_kws is None else facet_kws.copy()
-> 1027 g = FacetGrid(
1028 data=full_data.dropna(axis=1,how="all"),
1029 **grid_kws,
1030 col_wrap=col_wrap,row_order=row_order,col_order=col_order,
1031 height=height,aspect=aspect,dropna=False,
1032 **facet_kws
1033 )
1035 # Draw the plot
1036 g.map_dataframe(func, **plot_kws)
File /usr/lib/python3.11/site-packages/seaborn/_decorators.py:46, in _deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
36 warnings.warn(
37 "Pass the following variable{} as {}keyword arg{}: {}. "
38 "From version 0.12, the only valid positional argument "
(...)
43 FutureWarning
44 )
45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46 return f(**kwargs)
File /usr/lib/python3.11/site-packages/seaborn/axisgrid.py:409, in FacetGrid.__init__(self, data, row, col, hue, col_wrap, sharex, sharey, height, aspect, palette, row_order, col_order, hue_order, hue_kws, dropna, legend_out, despine, margin_titles, xlim, ylim, subplot_kws, gridspec_kws, size)
[405](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:406) # --- Initialize the subplot grid
[406](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:407)
[407](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:408) # Disable autolayout so legend_out works properly
[408](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:409) with mpl.rc_context({"figure.autolayout": False}):
--> [409](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:410) fig = plt.figure(figsize=figsize)
[411](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:412) if col_wrap is None:
[413](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:414) kwargs = dict(squeeze=False,
[414](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:415) sharex=sharex, sharey=sharey,
[415](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:416) subplot_kw=subplot_kws,
[416](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:417) gridspec_kw=gridspec_kws)
File /usr/lib64/python3.11/site-packages/matplotlib/_api/deprecation.py:454, in make_keyword_only.<locals>.wrapper(*args, **kwargs)
[448](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:449) if len(args) > name_idx:
[449](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:450) warn_deprecated(
[450](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:451) since, message="Passing the %(name)s %(obj_type)s "
[451](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:452) "positionally is deprecated since Matplotlib %(since)s; the "
[452](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:453) "parameter will become keyword-only %(removal)s.",
[453](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:454) name=name, obj_type=f"parameter of {func.__name__}()")
--> [454](https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532#step:10:455) return func(*args,**kwargs)
File /usr/lib64/python3.11/site-packages/matplotlib/pyplot.py:787, in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, clear, **kwargs)
774 _api.warn_external(
775 f"More than {max_open_warning} figures have been opened. "
776 f"Figures created through the pyplot interface "
(...)
780 f"Consider using `matplotlib.pyplot.close()`.",
781 RuntimeWarning)
783 manager = new_figure_manager(
784 num, figsize=figsize, dpi=dpi,
785 facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
786 FigureClass=FigureClass, **kwargs)
--> 787 fig = manager.canvas.figure
788 if fig_label:
789 fig.set_label(fig_label)
AttributeError: 'NoneType' object has no attribute 'canvas'
from https://github.com/votca/votca/actions/runs/3504789586/jobs/6000676532
Now also tracked as: https://bugzilla.redhat.com/show_bug.cgi?id=2149157
783 manager = new_figure_manager(
784 num, figsize=figsize, dpi=dpi,
785 facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
786 FigureClass=FigureClass, **kwargs)
--> 787 fig = manager.canvas.figure
new_figure_manager
is pulled from the backend you are using. This is saying that the object returned by this call is None
which should never be the case. Can you insert a print(mpl.get_backend())
someplace in this code or get into a debugger to check?
Could you point me at where the docs get built from and how?
One can reproduce this all inside our CI containers.
docker run -it ghcr.io/votca/buildenv/fedora:rawhide
then
git clone https://github.com/votca/votca
cd votca
mkdir build
cd build
cmake .. -DBUILD_XTP=ON -DENABLE_TESTING=ON
make
make doc
ValueError Traceback (most recent call last)
Cell In [5], line 6
4 columns = ["E(eV)", "counts"]
5 df = pd.read_table("eanalyze.pairhist_e.out", comment="#", sep='\s+',names=columns, skiprows=2)
----> 6 raise ValueError(plt.get_backend())
7 sns.relplot(x="E(eV)", y="counts", ci=None, kind="line", data=df)
8 plt.plot()
ValueError: module://matplotlib_inline.backend_inline
ValueError: module://matplotlib_inline.backend_inline
ninja: build stopped: subcommand failed.
[votca@3df035bcb6fd build]$ rpm -q python3-matplotlib
python3-matplotlib-3.6.2-1.fc38.x86_64
[votca@3df035bcb6fd build]$ rpm -q python3-matplotlib-inline
python3-matplotlib-inline-0.1.5-1.fc38.noarch
Rawhide has 0.1.5, and F37 is still on 0.1.2. That version is buggy ipython/matplotlib-inline#18 and it's fixed in 0.1.6. I've re-opened the update bug report so hopefully the maintainer will update it.
Update has arrived in rawhide, rebuilding the container (https://github.com/votca/buildenv/actions/runs/3598289186/jobs/6071466560)
That fixed it!
Thanks to all!