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

No plots after upgrading to jupyterlab 1.0.3 #131

Closed
yt87 opened this issue Jul 26, 2019 · 21 comments
Closed

No plots after upgrading to jupyterlab 1.0.3 #131

yt87 opened this issue Jul 26, 2019 · 21 comments

Comments

@yt87
Copy link

yt87 commented Jul 26, 2019

  • Installed packages:
(devel) pointyhaired@gtrojan> conda list ipympl
# packages in environment at /home/george.trojan/miniconda3/envs/devel:
#
# Name                    Version                   Build  Channel
ipympl                    0.3.3                      py_0    conda-forge
(devel) pointyhaired@gtrojan> conda list jupyter
# packages in environment at /home/george.trojan/miniconda3/envs/devel:
#
# Name                    Version                   Build  Channel
jupyter                   1.0.0                      py_2    conda-forge
jupyter_client            5.3.1                      py_0    conda-forge
jupyter_console           6.0.0                      py_0    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyterlab                1.0.3                    py37_0    conda-forge
jupyterlab_server         1.0.0                      py_1    conda-forge
(devel) pointyhaired@gtrojan> conda list ipython
# packages in environment at /home/george.trojan/miniconda3/envs/devel:
#
# Name                    Version                   Build  Channel
ipython                   7.6.1            py37h5ca1d4c_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge

(devel) pointyhaired@gtrojan> jupyter labextension list
JupyterLab v1.0.3
Known labextensions:
   app dir: /home/george.trojan/miniconda3/envs/devel/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.0.1  enabled  OK
        @pyviz/jupyterlab_pyviz v0.8.0  enabled  OK
        jupyter-matplotlib v0.4.2  enabled  OK
        jupyterlab-drawio v0.6.0  enabled  OK
        jupyterlab_bokeh v1.0.0  enabled  OK
        jupyterlab_vim v0.11.0  enabled  OK
  • Code:
%matplotlib widget
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(1, 1, 1)
_ = ax.plot([0, 1], [0, 1], '-')
plt.show()
  • Behaviour:

    • First run:
      Nothing appears in the browser (Firefox), log warnings:
[I 19:22:55.878 LabApp] Kernel restarted: cac8af90-19f9-46f3-b711-5dc73e000f4a
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
[IPKernelApp] WARNING | No such comm: 80813842daba4f89a97d734ec5a9abc6
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
[IPKernelApp] WARNING | No such comm: 685a0cc2c96941c784b15b72d3ded931
[IPKernelApp] WARNING | No such comm: c35f6dd5095f47639f7635fd9d59b77c
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
[IPKernelApp] WARNING | No such comm: d0d520499eb94506808d830dd0cdc294
  • Second run (without kernel restart):
    Control buttons (Toggle interaction etc...) displayed on the left, plot not shown. The log shows similar lines, with different codes.
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: b9cf5e11dc9748d4b690c69374fb8f1f
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: 61f984b852ea48d5b96153ca4799ad5d
[IPKernelApp] WARNING | No such comm: b01ce5d026b64cf0998b47413e9677a5
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555
  • Third run (without kernel restart):
    The log shows several identical lines
[IPKernelApp] WARNING | No such comm: e0fda28094cf418e84b5cf36b9a1f555

Traceback in the browser (buttons are not displayed):

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-e16fb2894584> in <module>
----> 1 get_ipython().run_line_magic('matplotlib', 'widget')
      2 import matplotlib.pyplot as plt
      3 fig = plt.figure(figsize=(8, 8))
      4 ax = fig.add_subplot(1, 1, 1)
      5 _ = ax.plot([0, 1], [0, 1], '-')

~/miniconda3/envs/devel/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2311                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2312             with self.builtin_trap:
-> 2313                 result = fn(*args, **kwargs)
   2314             return result
   2315 

</home/george.trojan/miniconda3/envs/devel/lib/python3.7/site-packages/decorator.py:decorator-gen-108> in matplotlib(self, line)

~/miniconda3/envs/devel/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~/miniconda3/envs/devel/lib/python3.7/site-packages/IPython/core/magics/pylab.py in matplotlib(self, line)
     97             print("Available matplotlib backends: %s" % backends_list)
     98         else:
---> 99             gui, backend = self.shell.enable_matplotlib(args.gui.lower())
    100             self._show_matplotlib_backend(args.gui, backend)
    101 

~/miniconda3/envs/devel/lib/python3.7/site-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui)
   3411                 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
   3412 
-> 3413         pt.activate_matplotlib(backend)
   3414         pt.configure_inline_support(self, backend)
   3415 

~/miniconda3/envs/devel/lib/python3.7/site-packages/IPython/core/pylabtools.py in activate_matplotlib(backend)
    312 
    313     import matplotlib.pyplot
--> 314     matplotlib.pyplot.switch_backend(backend)
    315 
    316     # This must be imported last in the matplotlib series, after

~/miniconda3/envs/devel/lib/python3.7/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
    193         The name of the backend to use.
    194     """
--> 195     close("all")
    196 
    197     if newbackend is rcsetup._auto_backend_sentinel:

~/miniconda3/envs/devel/lib/python3.7/site-packages/matplotlib/pyplot.py in close(fig)
    675             _pylab_helpers.Gcf.destroy(figManager.num)
    676     elif fig == 'all':
--> 677         _pylab_helpers.Gcf.destroy_all()
    678     elif isinstance(fig, int):
    679         _pylab_helpers.Gcf.destroy(fig)

~/miniconda3/envs/devel/lib/python3.7/site-packages/matplotlib/_pylab_helpers.py in destroy_all(cls)
     71         for manager in list(cls.figs.values()):
     72             manager.canvas.mpl_disconnect(manager._cidgcf)
---> 73             manager.destroy()
     74 
     75         cls._activeQue = []

~/miniconda3/envs/devel/lib/python3.7/site-packages/ipympl/backend_nbagg.py in destroy(self)
    211 
    212     def destroy(self):
--> 213         self.canvas.close()
    214 
    215 

~/miniconda3/envs/devel/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in close(self)
    465         if self.comm is not None:
    466             Widget.widgets.pop(self.model_id, None)
--> 467             self.comm.close()
    468             self.comm = None
    469             self._ipython_display_ = None

~/miniconda3/envs/devel/lib/python3.7/site-packages/ipykernel/comm/comm.py in close(self, data, metadata, buffers)
    114             data=data, metadata=metadata, buffers=buffers,
    115         )
--> 116         self.kernel.comm_manager.unregister_comm(self)
    117 
    118     def send(self, data=None, metadata=None, buffers=None):

~/miniconda3/envs/devel/lib/python3.7/site-packages/ipykernel/comm/manager.py in unregister_comm(self, comm)
     54         """Unregister a comm, and close its counterpart"""
     55         # unlike get_comm, this should raise a KeyError
---> 56         comm = self.comms.pop(comm.comm_id)
     57 
     58     def get_comm(self, comm_id):

KeyError: 'e0fda28094cf418e84b5cf36b9a1f555'

This happened on two computers updated with conda yesterday and today.

@yt87
Copy link
Author

yt87 commented Jul 26, 2019

Following advice in #130
Java console shows errors like this one:

Exception opening new comm
default.js:973
Error: Object 'jupyter.widget' not found in registry
Stack trace:
loadObject/<@http://127.0.0.1:8888/static/lab/vendors~main.171ef9fec69ebef81570.js:307455:28
loadObject@http://127.0.0.1:8888/static/lab/vendors~main.171ef9fec69ebef81570.js:307434:16
_handleCommOpen@http://127.0.0.1:8888/static/lab/vendors~main.171ef9fec69ebef81570.js:306923:32
_handleMessage@http://127.0.0.1:8888/static/lab/vendors~main.171ef9fec69ebef81570.js:307029:27
DefaultKernel/this._onWSMessage/this._msgChain<@http://127.0.0.1:8888/static/lab/vendors~main.171ef9fec69ebef81570.js:306079:24
default.js:127

@djhoese
Copy link

djhoese commented Jul 29, 2019

I had this same issue, but got it working some how. The main thing I did differently was made sure I followed every step of the instructions and made sure nodejs was installed (conda list nodejs). If you add nodejs (conda install nodejs) and restart jupyter lab does it work?

@djhoese
Copy link

djhoese commented Jul 29, 2019

Cancel that, it turns out all I needed to do:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyter-matplotlib

Although, my output for labextension lab didn't show them enabled before hand. Maybe rerunning these commands will rebuild JLab for you so it works?

@yt87
Copy link
Author

yt87 commented Jul 29, 2019

No luck. I reinstalled jupyter-matplotlib and @jupyter-widgets/jupyterlab-manager. Current versions are:

$ jupyter labextension list
JupyterLab v1.0.2
Known labextensions:
   app dir: /home/gtrojan/miniconda3/envs/numeric/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.0.2  enabled  OK
        jupyter-matplotlib v0.4.2  enabled  OK
        jupyterlab_vim v0.11.0  enabled  OK

Same thing happens with jupyterlab 1.0.2 and chromium browser. BTW,

$ conda list nodejs
# packages in environment at /home/gtrojan/miniconda3/envs/numeric:
#
# Name                    Version                   Build  Channel
nodejs                    11.14.0              he1b5a44_1    conda-forge

@russkel
Copy link

russkel commented Aug 1, 2019

I am also getting this error on Jupterlab 1.0.4. I have tried reinstalling. Jupyterlab must have changed something again.

@jasongrout
Copy link
Contributor

Nothing should have changed in a backwards incompatible way with JLab in a patch release. If you rebuild to pick up the extensions, does it work? jupyter lab build

What extensions does JLab say are installed?

@russkel
Copy link

russkel commented Aug 1, 2019

(x) russ@z820:~/x$ jupyter labextension list
JupyterLab v1.0.4
Known labextensions:
   app dir: /home/russ/.local/share/virtualenvs/x-DW7wxhU9/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.0.2  enabled  OK
        jupyter-matplotlib v0.4.2  enabled  OK
(x) russ@z820:~/x$ jupyter lab build
[LabBuildApp] JupyterLab 1.0.4
[LabBuildApp] Building in /home/russ/.local/share/virtualenvs/x-DW7wxhU9/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets
(x) russ@z820:~/x$ jupyter lab
[I 14:56:32.926 LabApp] JupyterLab extension loaded from /home/russ/.local/share/virtualenvs/x-DW7wxhU9/lib/python3.7/site-packages/jupyterlab
[I 14:56:32.926 LabApp] JupyterLab application directory is /home/russ/.local/share/virtualenvs/x-DW7wxhU9/share/jupyter/lab
[I 14:56:32.929 LabApp] Serving notebooks from local directory: /home/russ/x
[I 14:56:32.929 LabApp] The Jupyter Notebook is running at:
[I 14:56:32.929 LabApp] http://localhost:8888/?token=899c6306fe7642ecaa64e7407184d8e851a3d0c5fed87d97
[I 14:56:32.929 LabApp]  or http://127.0.0.1:8888/?token=899c6306fe7642ecaa64e7407184d8e851a3d0c5fed87d97
[I 14:56:32.929 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:56:32.983 LabApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/russ/.local/share/jupyter/runtime/nbserver-658-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=899c6306fe7642ecaa64e7407184d8e851a3d0c5fed87d97
     or http://127.0.0.1:8888/?token=899c6306fe7642ecaa64e7407184d8e851a3d0c5fed87d97
[I 14:56:37.174 LabApp] Build is up to date
[I 14:56:38.680 LabApp] Kernel started: 1ecf44bf-8b13-4bd3-bea3-a554c7371ef8
[I 14:56:38.718 LabApp] Kernel started: d7345068-2fb5-4543-85ea-69badd1ca8a6
|[I 14:56:39.452 LabApp] Adapting from protocol version 5.1 (kernel 1ecf44bf-8b13-4bd3-bea3-a554c7371ef8) to 5.3 (client).
\[I 14:56:39.465 LabApp] Adapting from protocol version 5.1 (kernel 1ecf44bf-8b13-4bd3-bea3-a554c7371ef8) to 5.3 (client).
[I 14:56:39.565 LabApp] Adapting from protocol version 5.1 (kernel d7345068-2fb5-4543-85ea-69badd1ca8a6) to 5.3 (client).
-[I 14:56:39.574 LabApp] Adapting from protocol version 5.1 (kernel d7345068-2fb5-4543-85ea-69badd1ca8a6) to 5.3 (client).

And when running using matplotlib:

[IPKernelApp] WARNING | No such comm: bf58fdab66604fd4bd5af9aba991c57f
[IPKernelApp] WARNING | No such comm: bf58fdab66604fd4bd5af9aba991c57f
[IPKernelApp] WARNING | No such comm: bf58fdab66604fd4bd5af9aba991c57f
[IPKernelApp] WARNING | No such comm: bf58fdab66604fd4bd5af9aba991c57f
[IPKernelApp] WARNING | No such comm: bf58fdab66604fd4bd5af9aba991c57f
[IPKernelApp] WARNING | No such comm: bf58fdab66604fd4bd5af9aba991c57f

@russkel
Copy link

russkel commented Aug 1, 2019

Hmm, I just tried with a fresh notebook and it worked.

@jasongrout
Copy link
Contributor

Did you happen to have a console open to the same kernel as the notebook? I just noticed today that that can break widgets with that no such comm error.

@russkel
Copy link

russkel commented Aug 1, 2019

No I didn't. I was experimenting with jupyterlab_bokeh and then updated Jupyterlab and then the notebook broke in the manner shown above. I thought it was updating lab that caused it. It wasn't.

Seems to be working now. Clear all outputs, save notebook, shutdown kernel, and then retry seemed to sort it out. 🤷‍♂️

@yt87
Copy link
Author

yt87 commented Aug 1, 2019

In my case it was console. Once it is open, nothing is plotted. Restarting kernel does not help. The server has to be stopped and started again to get rid of those "no such comm" errors.

@djhoese
Copy link

djhoese commented Aug 1, 2019

Did you happen to have a console open to the same kernel as the notebook?

@jasongrout Do you mean a terminal window inside jupyterlab or a regular local system terminal?

@jasongrout
Copy link
Contributor

jasongrout commented Aug 1, 2019

I meant the JLab tab opened by selecting the File > New > Console menu item.

@yt87
Copy link
Author

yt87 commented Aug 1, 2019

Confirmed behaviour from last night on a different computer: works till a console is opened. Closing console and restarting kernel does not fix the issue, the server has to be restarted.

Opened console for a different notebook is OK.

@jasongrout
Copy link
Contributor

works till a console is opened. Closing console and restarting kernel does not fix the issue, the server has to be restarted.

I'm working on a fix for this.

@jasongrout
Copy link
Contributor

Prototype fix up at jupyterlab/jupyterlab#6929

@yoichi-kazama
Copy link

I have the same problem after I upgraded Jupyterlab from 1.0.2 to 1.0.5 today. Is there any workaround?

Environment:
Windows 8.1, Firefox 68.0.1, Jupyterlab 1.0.5, python 3.7.3, via conda

@thomasaarholt
Copy link
Contributor

I installed yesterday without issues. @yoichi-kazama can you confirm that you followed the readme instructions?

@jasongrout
Copy link
Contributor

Confirmed behaviour from last night on a different computer: works till a console is opened. Closing console and restarting kernel does not fix the issue, the server has to be restarted.

Just confirming: the fix for this problem has been released in jlab 1.1.0alpha1, and will be in jlab 1.1.0

@yoichi-kazama
Copy link

Hi @thomasaarholt thank you for the information. I uninstalled/reinstalled conda and setup Jupyterlab 1.0.5, matplotlib 3.1.1 and ipympl 0.3.3 via conda-forge, and it's working. Thanks!

@jasongrout
Copy link
Contributor

Great!

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

6 participants