3.2.0: error while generating doc gallery: `ValueError: operands could not be broadcast together with shapes (370,370) (100,100)` · Issue #16707 · matplotlib/matplotlib · GitHub
Skip to content

3.2.0: error while generating doc gallery: ValueError: operands could not be broadcast together with shapes (370,370) (100,100) #16707

Description

@sandrotosi

Hello,
while preparing 3.2.0 for Debian, the documentation gallery build process failed with:

...
generating gallery for gallery/images_contours_and_fields... [ 38%] image_demo.py
generating gallery for gallery/images_contours_and_fields... [ 40%] image_masked.py
generating gallery for gallery/images_contours_and_fields... [ 42%] image_nonuniform.py
generating gallery for gallery/images_contours_and_fields... [ 45%] image_transparency_blend.py

Exception occurred:
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 530, in _make_image
    np.asarray(alpha_channel, np.float32) * out_alpha * alpha,
ValueError: operands could not be broadcast together with shapes (370,370) (100,100)
The full traceback has been saved in /tmp/sphinx-err-glmke_9_.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

the content of /tmp/sphinx-err-glmke_9_.log is:

# Sphinx version: 1.8.5
# Python version: 3.8.2 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.10.1
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/cmd/build.py", line 300, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3/dist-packages/sphinx/application.py", line 263, in __init__
    self._init_builder()
  File "/usr/lib/python3/dist-packages/sphinx/application.py", line 325, in _init_builder
    self.emit('builder-inited')
  File "/usr/lib/python3/dist-packages/sphinx/application.py", line 510, in emit
    return self.events.emit(event, self, *args)
  File "/usr/lib/python3/dist-packages/sphinx/events.py", line 80, in emit
    results.append(callback(*args))
  File "/usr/lib/python3/dist-packages/sphinx_gallery/gen_gallery.py", line 283, in generate_gallery_rst
    generate_dir_rst(src_dir, target_dir, gallery_conf,
  File "/usr/lib/python3/dist-packages/sphinx_gallery/gen_rst.py", line 327, in generate_dir_rst
    intro, cost = generate_file_rst(
  File "/usr/lib/python3/dist-packages/sphinx_gallery/gen_rst.py", line 740, in generate_file_rst
    output_blocks, time_elapsed = execute_script(script_blocks,
  File "/usr/lib/python3/dist-packages/sphinx_gallery/gen_rst.py", line 659, in execute_script
    output_blocks = [execute_code_block(compiler, block,
  File "/usr/lib/python3/dist-packages/sphinx_gallery/gen_rst.py", line 659, in <listcomp>
    output_blocks = [execute_code_block(compiler, block,
  File "/usr/lib/python3/dist-packages/sphinx_gallery/gen_rst.py", line 565, in execute_code_block
    images_rst = save_figures(block, script_vars, gallery_conf)
  File "/usr/lib/python3/dist-packages/sphinx_gallery/scrapers.py", line 236, in save_figures
    rst = scraper(block, block_vars, gallery_conf)
  File "/usr/lib/python3/dist-packages/sphinx_gallery/scrapers.py", line 99, in matplotlib_scraper
    fig.savefig(image_path, **these_kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 2082, in print_figure
    result = print_method(
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 527, in print_png
    FigureCanvasAgg.draw(self)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 388, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1708, in draw
    mimage._draw_list_compositing_images(
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2647, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 618, in draw
    im, l, b, trans = self.make_image(
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 879, in make_image
    return self._make_image(
  File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 530, in _make_image
    np.asarray(alpha_channel, np.float32) * out_alpha * alpha,
ValueError: operands could not be broadcast together with shapes (370,370) (100,100) 

Some noteworthy deps are:

  • numpy 1.17.4
  • sphinx 1.8.5
  • sphinx-gallery: 0.5.0
  • python 3.8.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions