holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.82k stars 521 forks source link

pixi run docs-build missing Webdriver #7119

Open cdeil opened 3 months ago

cdeil commented 3 months ago

I followed https://holoviz-dev.github.io/panel/developer_guide/index.html#documentation to run

panel $ pixi run docs-build 

which ran

✨ Pixi task (_docs-generate in docs): nbsite build --what=html --output=builtdocs --org holoviz --project-name panel

which gave this RuntimeError:

getting thumbnail code for /Users/cdeil/code/oss/panel/examples/reference/widgets/FileDropper.ipynb
Path exists True
Traceback (most recent call last):
  File "/var/folders/6v/0_6nt0pj07x9xjhd8qzkyy700000gn/T/tmp6jv8j0iz", line 67, in <module>
    from nbsite.gallery.thumbnailer import thumbnail;thumbnail(file_dropper, '/Users/cdeil/code/oss/panel/doc/reference/widgets/thumbnails/FileDropper')
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/site-packages/nbsite/gallery/thumbnailer.py", line 133, in thumbnail
    obj.save(basename+'.png')
  File "/Users/cdeil/code/oss/panel/panel/viewable.py", line 964, in save
    return save(
           ^^^^^
  File "/Users/cdeil/code/oss/panel/panel/io/save.py", line 270, in save
    return save_png(
           ^^^^^^^^^
  File "/Users/cdeil/code/oss/panel/panel/io/save.py", line 85, in save_png
    state.webdriver = webdriver_control.create()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/site-packages/bokeh/io/webdriver.py", line 180, in create
    driver = self._create(kind, scale_factor=scale_factor)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/site-packages/bokeh/io/webdriver.py", line 198, in _create
    raise RuntimeError("Neither firefox and geckodriver nor a variant of chromium browser and " \
RuntimeError: Neither firefox and geckodriver nor a variant of chromium browser and chromedriver are available on system PATH. You can install the former with 'conda install -c conda-forge firefox geckodriver'.
FileDropper thumbnail export failed

and same error for examples/reference/chat/ChatStep.ipynb

Is this a missing dependency in the .pixi/envs/docs spec?

cdeil commented 3 months ago

I get many warnings and errors from the docs build, see full log

Although in the end I think it's just a handful of issues that repeat over and over.

What about this bokeh-plot directive? Why does it not exist for me? https://gist.github.com/cdeil/9fc1a1cd292948f34fef7bfeb9c77a25#file-gistfile1-txt-L132

docstring of panel.models.icon.ButtonIcon.button_type:4: ERROR: Unknown directive type "bokeh-plot".

.. bokeh-plot::
    :source-position: none

    from bokeh.core.enums import ButtonType

What about the dot command? Is it needed? Should it be added to the .pixi/env/docs install? https://gist.github.com/cdeil/9fc1a1cd292948f34fef7bfeb9c77a25#file-gistfile1-txt-L518

I'm happy to contribute to the docs e.g. to fix the broken links and cross-references pointed out by Sphinx. But would prefer to have a working local setup first to be able to check any edits.

hoxbro commented 3 months ago

To create the images, firefox and geckodriver are needed in the doc feature.

However, those packages are only needed when new notebooks are added and the images have yet to be uploaded to AWS.

philippjfr commented 3 months ago

We should just disable the automatic screenshotting, we don't generally use it and the fact that it's failing indicates we haven't uploaded all the thumbnails.

hoxbro commented 3 months ago

The build will not fail, it will keep going but it shows the traceback.

cdeil commented 3 months ago

Build currently fails for me like this on MacOS:

Extension error (nbsite.gallery.gen):
Handler <function generate_gallery_rst at 0x16a231440> for event 'builder-inited' threw an exception (exception: cannot identify image file '/Users/cdeil/code/oss/panel/doc/reference/widgets/thumbnails/FloatSlider.png')
Traceback (most recent call last):
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/bin/nbsite", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/site-packages/nbsite/__main__.py", line 63, in main
    return args.func(args) if hasattr(args,'func') else parser.error("must supply command to run")
           ^^^^^^^^^^^^^^^
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/site-packages/nbsite/__main__.py", line 18, in <lambda>
    parser.set_defaults(func=lambda args: fn( **{k: getattr(args,k) for k in vars(args) if k!='func'} ))
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/site-packages/nbsite/cmd.py", line 92, in build
    subprocess.check_call(["sphinx-build","-b",what,paths['doc'],output], env=merged_env)
  File "/Users/cdeil/code/oss/panel/.pixi/envs/docs/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sphinx-build', '-b', 'html', '/Users/cdeil/code/oss/panel/doc', 'builtdocs']' returned non-zero exit status 2.

I see you touched that line here: https://github.com/holoviz-dev/nbsite/pull/311 Maybe that would fix it?

hoxbro commented 3 months ago

Maybe that would fix it?

It would still fail with my change, as the command in the subprocess that is failing. My change would only make it somewhat easier to see it.

I have submitted a PR, which should fix your problem.