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

Introductory example doesn't seem to work #415

Closed
quasiben opened this issue May 7, 2019 · 36 comments
Closed

Introductory example doesn't seem to work #415

quasiben opened this issue May 7, 2019 · 36 comments

Comments

@quasiben
Copy link

quasiben commented May 7, 2019

Setup

Machine: OSX
relevant conda packages:

  • jupyterlab 0.35.5
  • panel 0.5.1
  • python 3.7.2
  • matplotlib 3.0.3

I naively copied the sine example on the introduction page into a jupyter notebook. The mpl plot appeared however manipulating the widgets produced no outcome:

import numpy as np, pandas as pd, matplotlib.pyplot as plt
%matplotlib inline

def mplplot(df, **kwargs):
    fig = df.plot().get_figure()
    plt.close(fig)
    return fig

def sine(frequency=1.0, amplitude=1.0, n=200, view_fn=mplplot):
    xs = np.arange(n)/n*20.0
    ys = amplitude*np.sin(frequency*xs)
    df = pd.DataFrame(dict(y=ys), index=xs)
    return view_fn(df, frequency=frequency, amplitude=amplitude, n=n)

sine(1.5, 2.5)

import panel as pn
pn.extension()

pn.interact(sine)
@philippjfr
Copy link
Member

You have the JupyterLab extension installed? You can get it with:

jupyter labextension install @pyviz/jupyterlab_pyviz

@quasiben
Copy link
Author

quasiben commented May 7, 2019

Ah! I did not have that installed! Thanks!!!

@quasiben quasiben closed this as completed May 7, 2019
@quasiben quasiben reopened this May 7, 2019
@quasiben
Copy link
Author

quasiben commented May 7, 2019

After installing the extension I am still no seeing any behavior when moving the sliders

@philippjfr
Copy link
Member

Should maybe mention it again in the Introductory paragraph.

@philippjfr
Copy link
Member

That's bizarre, does the browser JS console have any errors in it? Could you also try clearing the notebook and reloading the page?

@quasiben
Copy link
Author

quasiben commented May 7, 2019

There is a JS console error:

44VM62:7 Uncaught TypeError: Cannot read property '1001' of undefined
    at eval (eval at get (lab:140), <anonymous>:7:38)
    at i.execute (<anonymous>:140:220931)
    at e.<anonymous> (<anonymous>:140:142322)
    at e.t.emit (<anonymous>:140:68660)
    at e.emit (<anonymous>:140:68847)
    at e._setv (<anonymous>:140:25486)
    at e.setv (<anonymous>:140:25916)
    at e.set [as value] (<anonymous>:140:23724)
    at e._slide (<anonymous>:216:6747)
    at Object.<anonymous> (<anonymous>:216:5552)

@philippjfr
Copy link
Member

That definitely looks to be responsible for the issue. I've encountered that once before but it went away when I tried again in a new session so I was never able to debug it. I'll try to reproduce using your setup:

  1. Install new environment (without JLab extension)
  2. Run Introduction
  3. Install JLab extension
  4. Rerun notebook again.

For better reproducibility could you tell me if you restarted the JLab server, cleared the notebook and/or reloaded the browser window in between any of those steps? Also lastly, could you confirm you have pyviz_comms 0.7.2?

@quasiben
Copy link
Author

quasiben commented May 7, 2019

I cleared the notebook, restarted the server, and started an incognito browser session:

❯ conda list pyviz_comms
# packages in environment at /Users/bzaitlen/miniconda3/envs/dask-dev:
#
# Name                    Version                   Build  Channel
pyviz_comms               0.7.2                      py_0

@quasiben
Copy link
Author

quasiben commented May 7, 2019

Thanks for looking into this!

@philippjfr
Copy link
Member

And it's still not working now?

@quasiben
Copy link
Author

quasiben commented May 7, 2019

correct

@philippjfr
Copy link
Member

Thanks for looking into this!

No problem, pretty crucial to have first set up going smoothly. Was hoping to release an official announcement blog post next week. Having new users run into this issue immediately is definitely not good.

@philippjfr
Copy link
Member

philippjfr commented May 7, 2019

Oh one more question, what's the bokeh version? Will assume it's 1.1.0 but you never know.

@quasiben
Copy link
Author

quasiben commented May 7, 2019

❯ conda list bokeh
# packages in environment at /Users/bzaitlen/miniconda3/envs/dask-dev:
#
# Name                    Version                   Build  Channel
bokeh                     1.1.0                    py37_0

@philippjfr
Copy link
Member

Ugh, bad news, I can't reproduce it. One last question did you get the packages conda-forge?

@quasiben
Copy link
Author

quasiben commented May 7, 2019

I don't think so, it looks like they all came from defaults. Should I use conda-forge ?

@philippjfr
Copy link
Member

Ah okay, I'll try a new env from defaults now. Hadn't even realized everything made it onto defaults already.

@quasiben
Copy link
Author

quasiben commented May 7, 2019

i can also build a new env with conda-forge.

@philippjfr
Copy link
Member

That would be appreciated, thanks for being so patient debugging this with me!

@philippjfr
Copy link
Member

philippjfr commented May 7, 2019

Yes! It's broken with the packages from defaults, now I just need to figure out why.

@philippjfr
Copy link
Member

philippjfr commented May 7, 2019

Okay, it seems to be a race condition caused by placing the pn.extension() call into the same cell as the first output. I don't know why it occurs in the defaults environment and not in the conda-forge one but I'm guessing it could be the JupyterLab version difference between the two (0.35.5 vs. 0.35.6).

@quasiben
Copy link
Author

quasiben commented May 7, 2019

Yup! Moving the call to pn.extension() to another cell fixed the issue. Thanks! Do you want to close this and start another issue ? Also, I'm happy to help with docs if you'd like

@philippjfr
Copy link
Member

Going to push a minor version of the JupyterLab extension shortly once this is merged: holoviz/pyviz_comms#36

That should fix it when both are in the same cell too.

@philippjfr
Copy link
Member

Okay, just merged and pushed the updated JupyterLab extension to npm. Would you mind trying to update?

Also, I'm happy to help with docs if you'd like

That would be hugely appreciated, so far I've basically written almost all of them with a little editing here or there by @jbednar. They would definitely benefit from a second pair of eyes, even if you just mean the mention of the JLab extension in the introduction.

@sdc50
Copy link
Contributor

sdc50 commented May 7, 2019

@philippjfr I was having the same issue (but with a different notebook). I just reinstalled the updated JupyterLab extension and that seems to have fixed it.

I now occasionally get a different error:

Uncaught Error: Cannot send
    at CommHandler.send (comm.js:111)
    at Object.sendClosure [as send] (renderer.js:137)
    at process_events (eval at get (lab:140), <anonymous>:43:10)
    at eval (eval at get (lab:140), <anonymous>:91:27)

But it only happens with the following steps:

  1. Render a cell
  2. Restart the kernel (without clearing cell outputs)
  3. Refresh the browser page
  4. Render the cell again
  5. Click on one of the widgets

Even with the error showing up in the console everything still seems to work. I just thought I'd mention it in case it was related.

@philippjfr
Copy link
Member

Thanks @sdc50 that's probably an unrelated issue. I think the issue there is that the comm which is responsible for affirming that the frontend has received and processed an event from the backend is not being correctly re-established after reloading the page. Those events are important but not crucial which is why it all appears to work.

@philippjfr
Copy link
Member

Going to close this since the immediate issue has been addressed.

@phimit
Copy link

phimit commented Apr 1, 2020

Same problem here on Macos Mojave

Installed everything from scratch in a new environnment, recent packages.
Nothing shows in both notebook and jupyter lab.
(and no hv-extension-comm appears in notebook terminal)
I also put pn.extension in separate cell.

jupyter 1.0.0 py38_7
jupyter_client 6.1.2 py_0
jupyter_console 6.1.0 py_0
jupyter_core 4.6.3 py38_0
jupyterlab 2.0.1 py_0 conda-forge
jupyterlab_server 1.1.0 py_0 conda-forge

panel 0.9.3 py_0 pyviz
param 1.9.3 py_0 pyviz
pyct 0.4.6 py_0 pyviz
pyct-core 0.4.6 py_0 pyviz
pyviz_comms 0.7.4 py_0 pyviz

@philippjfr
Copy link
Member

Can't reproduce, @phimit do you have the jupyterlab extension installed?

  jupyter labextension install @pyviz/jupyterlab_pyviz

@phimit
Copy link

phimit commented Apr 1, 2020

Yes I have.
I should have added my conda version: current version: 4.6.9

If it helps, here's the output from the classic notebook:
[W 12:30:12.681 NotebookApp] 404 GET /nbextensions/hv-comm.js?v=20200401122952 (::1) 34.32ms referer=http://localhost:8889/notebooks/Test.ipynb
[W 12:30:12.688 NotebookApp] 404 GET /nbextensions/hv-extension-comm.js?v=20200401122952 (::1) 5.61ms referer=http://localhost:8889/notebooks/Test.ipynb
[W 12:30:12.705 NotebookApp] 404 GET /nbextensions/pyviz_comms.js?v=20200401122952 (::1) 5.03ms referer=http://localhost:8889/notebooks/Test.ipynb
[W 12:30:13.072 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200401122952 (::1) 4.01ms referer=http://localhost:8889/notebooks/Test.ipynb

@phimit
Copy link

phimit commented Apr 1, 2020

Tested on a linux machine, same conditions (new conda env), same results (both with classic notebook and lab). no hv-extension-comm warning though.

The only weird common thing is I had to install matplotlib... I thought it was already in base conda.

@evanfollis
Copy link

I am having the same issue. pn.interact(fn) does not do anything. I am running panel version 0.9.3

@philippjfr
Copy link
Member

Could both of you try to upgrade to 0.9.5? All the packaging issues there should have been resolved now.

@evanfollis
Copy link

Yes! 0.9.5 fixed the issue. Thank you!

@phimit
Copy link

phimit commented Apr 9, 2020 via email

@philippjfr
Copy link
Member

Great! Thanks for reporting back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants