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

Error compiling docs for v4.1.0 tag #2092

Closed
capac opened this issue Apr 16, 2020 · 7 comments
Closed

Error compiling docs for v4.1.0 tag #2092

capac opened this issue Apr 16, 2020 · 7 comments

Comments

@capac
Copy link

capac commented Apr 16, 2020

I'm having issues compiling the docs from the 4.1.0 tag on macOS. I've correctly installed altair_saver and all the other required packages according to the instructions, but after running make clean-all and make html, PIL doesn't seem able to view anscombe_plot.png. Any suggestions?

-> saving /Users/angelo/Programming/docs/altair/doc/_images/anscombe_plot.png
TypeError: Cannot read property 'getContext' of null
    at resize (/Users/angelo/.conda/envs/docs/lib/vega-cli/node_modules/vega-scenegraph/build/vega-scenegraph.js:3377:26)
    at CanvasRenderer.prototype$6.resize (/Users/angelo/.conda/envs/docs/lib/vega-cli/node_modules/vega-scenegraph/build/vega-scenegraph.js:3427:5)
    at CanvasRenderer.prototype$4.initialize (/Users/angelo/.conda/envs/docs/lib/vega-cli/node_modules/vega-scenegraph/build/vega-scenegraph.js:2989:17)
    at CanvasRenderer.prototype$6.initialize (/Users/angelo/.conda/envs/docs/lib/vega-cli/node_modules/vega-scenegraph/build/vega-scenegraph.js:3422:28)
    at initializeRenderer (/Users/angelo/.conda/envs/docs/lib/vega-cli/node_modules/vega-view/build/vega-view.js:630:8)
    at renderHeadless (/Users/angelo/.conda/envs/docs/lib/vega-cli/node_modules/vega-view/build/vega-view.js:736:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Exception occurred:
  File "/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/PIL/Image.py", line 2862, in open
    "cannot identify image file %r" % (filename if filename else fp)
PIL.UnidentifiedImageError: cannot identify image file '/Users/angelo/Programming/docs/altair/doc/_images/anscombe_plot.png'

From the full traceback:

# Sphinx version: 2.4.4
# Python version: 3.7.7 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.1
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/sphinx/cmd/build.py", line 275, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/sphinx/application.py", line 278, in __init__
    self._init_builder()
  File "/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/sphinx/application.py", line 334, in _init_builder
    self.events.emit('builder-inited')
  File "/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/sphinx/events.py", line 99, in emit
    results.append(callback(self.app, *args))
  File "/Users/angelo/Programming/docs/altair/altair/sphinxext/altairgallery.py", line 291, in main
    save_example_pngs(examples, image_dir)
  File "/Users/angelo/Programming/docs/altair/altair/sphinxext/altairgallery.py", line 154, in save_example_pngs
    create_thumbnail(image_file, thumb_file, **params)
  File "/Users/angelo/Programming/docs/altair/altair/sphinxext/utils.py", line 12, in create_thumbnail
    im = Image.open(image_filename)
  File "/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/PIL/Image.py", line 2862, in open
    "cannot identify image file %r" % (filename if filename else fp)
PIL.UnidentifiedImageError: cannot identify image file '/Users/angelo/Programming/docs/altair/doc/_images/anscombe_plot.png'
@jakevdp
Copy link
Collaborator

jakevdp commented Apr 16, 2020

You are hitting this error in saving charts: altair-viz/altair_saver#13 I'm not certain what the solution is.

The best approach is probably to use the selenium saver instead; it doesn't have the same issues that the node saver does.

@capac
Copy link
Author

capac commented Apr 17, 2020

Following the link you posted, I installed the npm packages globally and after updating to the latest vega_datasets package, I was able to successfully compile the docs. However I have a few issues with the resulting HTML files. I've noticed that in the doc/_build/html directory, opening the index.html which shows the Home page, you can't see the thumbnail images at the top of the page, and in the Gallery section of the Home page the thumbnail images don't appear either. What happens for the index.html file in the doc directory and for the index.html in the gallery directory is that the path to the _images directory are wrong. I had to manually change them to make the thumbnails appear. The cause of the problem could be this error message which appeared after the images were generated:

[...]
-> saving /Users/angelo/Programming/docs/altair/doc/_images/world_projections.png
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 44 source files that are out of date
updating environment: [new config] 645 added, 0 changed, 0 removed
/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document
  warn("Container node skipped: type={0}".format(mdnode.t))
/Users/angelo/Programming/docs/altair/altair/sphinxext/schematable.py:34: UserWarning: cannot infer type for schema with keys dict_keys(['description', 'not'])
  "cannot infer type for schema with keys {}" "".format(schema.keys())
/Users/angelo/.conda/envs/docs/lib/python3.7/site-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document
  warn("Container node skipped: type={0}".format(mdnode.t))
reading sources... [100%] user_guide/troubleshooting

I had a very similar issue when I compiled the docs for version 3.2.0. Any help to avoid this behavior in the future?

@jakevdp
Copy link
Collaborator

jakevdp commented Apr 17, 2020

I'm not sure what the issue is – it works correctly for me when I build locally, and seems to be working correctly in the CI: https://github.com/altair-viz/altair/runs/595606949

I'm not certain those warnings are related to the location of the generated thumbnails... the sphinx warnings are unfortunately pretty noisy, and I haven't had time to dig in and fix it.

@eitanlees
Copy link
Contributor

@capac I have had the issue with the thumbnails as well! I never brought it up because I wasn't sure if it was only a problem on my end but it's good to know it's not just me.

@capac
Copy link
Author

capac commented Apr 18, 2020

I built the Altair docs for the Dash docset package, so that the thumbnails would show up in the docs. However in order to do so I had to copy the doc/_images folder into the Dash package and modify the thumbnail paths accordingly, which is at best a hack. Sure, the docs do compile without error but the thumbnail paths are incorrect, at least to my knowledge.

@jakevdp jakevdp added the bug label Apr 20, 2020
@jakevdp
Copy link
Collaborator

jakevdp commented Apr 29, 2020

OK, thanks. I'm not able to reproduce this locally, so I'm unable to debug it. Please send a pull request if you find a fix!

@binste
Copy link
Contributor

binste commented May 26, 2023

Closing this as superseded by the discussion in #3028

@binste binste closed this as completed May 26, 2023
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

5 participants