holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.08k stars 105 forks source link

Can't import hvplot.pandas #573

Closed stualden closed 3 years ago

stualden commented 3 years ago

Complete, minimal, self-contained example code that reproduces the issue

import hvplot.pandas

Problem description

When I try the import, I get the following response in a Jupyter Notebook on Chrome or Edge:

Javascript error adding output!
Error: Cannot find module '@bokehjs/styles/buttons'
See your browser Javascript console for more details.

With Internet Explorer, I get the following (both messages):

Javascript error adding output!
SyntaxError: Expected ';'
See your browser Javascript console for more details.

Javascript error adding output!
SyntaxError: Syntax error
See your browser Javascript console for more details.

After that, any calls to hvplot produce no output.

Console output

main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:45677 actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
MenuBar.bind_events @ main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:45677
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:24190 load_extensions Arguments(4)
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:33602 Loaded moment locale en
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:24167 Loading extension: nbextensions_configurator/config_menu/main
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:24167 Loading extension: contrib_nbextensions_help_item/main
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:24167 Loading extension: execute_time/ExecuteTime
ExecuteTime.js?v=20210311005344:55 [ExecuteTime] patching CodeCell.prototype.get_callbacks
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:24167 Loading extension: jupyter-js-widgets/extension
2main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35558 Ignoring untrusted application/javascript output.
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:27218 HTML Sanitizer script removed Object
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:38824 Session: kernel_created (8cd85549-c81e-404a-a24a-45f79172e6d1)
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:37969 Starting WebSockets: ws://localhost:8888/api/kernels/321c83fb-1f7d-45bf-9d02-d837034df23d
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:37612 Kernel: kernel_connected (321c83fb-1f7d-45bf-9d02-d837034df23d)
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:37612 Kernel: kernel_ready (321c83fb-1f7d-45bf-9d02-d837034df23d)
VM40:305 [bokeh] setting log level to: 'info'
main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35621 Error: Cannot find module '@bokehjs/styles/buttons'
    at require (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:210:27)
    at Object._ (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:1072:153)
    at require (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:228:27)
    at Object._ (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:1033:487)
    at require (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:228:27)
    at Object._ (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:1032:120)
    at require (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:228:27)
    at Object.main.register_plugin (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:268:24)
    at eval (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:1026:26)
    at eval (eval at append_javascript (main.min.js?v=3d694ae0395dfef075eb0c5e8f10a21a8689f66b1e109f0c303b3573fd6512da3aebdc33284fe88676520a882517a504aec0051332d7d513d7c542465fc96b6f:35619), <anonymous>:1031:7)
DevTools failed to load SourceMap: Could not load content for http://localhost:8888/static/notebook/js/main.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

ALL software version info

channels:

dependencies:

Thank you! If this is a bokeh issue rather than an hvplot issue, please advise.

hoxbro commented 3 years ago

Try updating panel to the latest version with this command conda install panel=0.11 -c pyviz

stualden commented 3 years ago

Thank you! That eliminated the error message. Then to get hvplot to actually work, I needed to create fresh notebooks - any existing notebook that had been run with the old panel was "tainted" (it appears to be this bug).

Just one more question (and then I'll get back to work!) - is it best to use the pyviz channel for anything hvplot related, overriding conda defaults where needed? (For example, in this case, a conda update --all would just move me back to panel 0.10.3.) Thanks again.

hoxbro commented 3 years ago

Good to hear that it worked.

I use the pyviz channel for all the pyviz packages , e.g. panel, holoviews, etc. I have the following setup for my .condarc file.

ssl_verify: true
channels:
  - pyviz
  - conda-forge
  - defaults
stualden commented 3 years ago

Thank you, I will try that channel priority.

Should I re-report the IPKernelApp No such comm: hv-extension-comm bug? Looks like that ticket was closed back in April 2019, but the bug appears to still be there (I just triggered it a different way, that's all).

jbednar commented 3 years ago

Yes, that's the channel priority I'd use; pyviz is always either equal to or more up to date than conda-forge or defaults.

The "No such comm" warnings are meaningless but very irritating. I've offered $500 USD to anyone who can safely eliminate them, but so far no takers.

stualden commented 3 years ago

Once I'm up to speed on all this, I may just take on your offer :-)

It's not so much the warning that bothers me, it's the accompanying fact that after a notebook has experienced an error like the one I described above, calls to hvplot don't generate any output in the notebook (and instead just generate those annoying warnings in the console).

Restarting the kernel or reloading the notebook doesn't fix it, even with (in my case) an updated panel. You have to copy your code to a brand new notebook and run that. That's the bug (at least it seems like a bug) I'd like to report, but I guess I'm not sure where to report it.

philippjfr commented 3 years ago

@stualden I suspect that's weird incompatible versions sticking around. The procedure to fix that is usually:

  1. Clear the notebook
  2. Save
  3. (If in JupyterLab repeat for all open JLab tabs)
  4. Reload the page

I'm still working out an approach that would resolve this properly.

jbednar commented 3 years ago

And in any case the "No such comm" messages are generally unrelated to the actual problem; people see them whenever they are experiencing a problem and thus think they are relevant, but they also occur when there is no problem, so they are really just a distraction!

stualden commented 3 years ago

Thank you everyone - I'm grateful for your help, and once again a happy hvplot user.