widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.62k stars 105 forks source link

Jupyter Lab: Simple demo failure #86

Closed babazaroni closed 12 months ago

babazaroni commented 1 year ago

On Jupyter Lab, the simple word demo gives me 'Error displaying widget'. I'm running the latest ubuntu and chrome. Jupyter server version is 1.4.1.

Here is some of the log that might be helpful

manager-base.js:274 Could not instantiate widget (anonymous) @ manager-base.js:274 u @ manager-base.js:45 (anonymous) @ manager-base.js:26 a @ manager-base.js:18 Promise.then (async) u @ manager-base.js:19 (anonymous) @ manager-base.js:20 P @ manager-base.js:16 t._make_model @ manager-base.js:258 (anonymous) @ manager-base.js:247 u @ manager-base.js:45 (anonymous) @ manager-base.js:26 (anonymous) @ manager-base.js:20 P @ manager-base.js:16 t.new_model @ manager-base.js:233 t.handle_comm_open @ manager-base.js:145 _handleCommOpen @ 523.fa256ee012d38a89b65a.js:1 _handleCommOpen @ default.js:1021 await in _handleCommOpen (async) _handleMessage @ default.js:1189 await in _handleMessage (async) (anonymous) @ default.js:109 Promise.then (async) C._onWSMessage @ default.js:106 utils.js:119 Error: Could not create a model. at r (utils.js:119:27) at async _handleCommOpen (523.fa256ee012d38a89b65a.js:1:2798) at async C._handleCommOpen (default.js:1020:102) at async C._handleMessage (default.js:1188:43) r @ utils.js:119 Promise.catch (async) t.handle_comm_open @ manager-base.js:150 _handleCommOpen @ 523.fa256ee012d38a89b65a.js:1 _handleCommOpen @ default.js:1021 await in _handleCommOpen (async) _handleMessage @ default.js:1189 await in _handleMessage (async) (anonymous) @ default.js:109 Promise.then (async) C._onWSMessage @ default.js:106 default.js:1027 Exception opening new comm _handleCommOpen @ default.js:1027 await in _handleCommOpen (async) _handleMessage @ default.js:1189 await in _handleMessage (async) (anonymous) @ default.js:109 Promise.then (async) C._onWSMessage @ default.js:106

babazaroni commented 1 year ago

Here is the Jupyter Lab versions:

jupyterlab 3.0.11 pyhd3eb1b0_1
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 2.4.0 pyhd3eb1b0_0
jupyterlab_widgets 1.0.0 pyhd3eb1b0_1

babazaroni commented 1 year ago

I also ran the demo code in Jupyter Notebook. It worked, but was preceded by the following error:

Could not check jupyter-widgets extensions. Traceback (most recent call last): File "/home/cc/anaconda3/lib/python3.7/site-packages/solara/checks.py", line 93, in check_jupyter python_executable = server_python or get_server_python_executable(silent) File "/home/cc/anaconda3/lib/python3.7/site-packages/solara/checks.py", line 37, in get_server_python_executable servers += list(serverapp.list_running_servers()) File "/home/cc/anaconda3/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 2129, in list_running_servers info = json.load(f) File "/home/cc/anaconda3/lib/python3.7/json/init.py", line 296, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/home/cc/anaconda3/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/home/cc/anaconda3/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/cc/anaconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

babazaroni commented 1 year ago

While importing another package, pystore, suddenly stopped working with the error ''EntryPoints' object has no attribute 'get''. The solution was to pin a package with !pip install importlib-metadata==4.13.0. As pip was executing, I saw solara was also impacted. So I tried the solara simple demo script again, and it worked. However, I still get the error described in previous message regarding jupyter widgets extension.

maartenbreddels commented 1 year ago

Good to hear it is working. I think the error means there is something wrong with kernels that are added, or a crashed server. This can also be considered a bug in jupyter_server. Is it a show-stopper for you? Or just slightly annoying?

babazaroni commented 1 year ago

It is only slightly annoying. However, the other error regarding the jupyter extension version is a problem, as it displays a a red exception trace above the widget.

maartenbreddels commented 1 year ago

The workaround for now is to execute this before importing solara:

import logging
logger = logging.getLogger("solara.checks")
logger.disabled = True

If other people get this issue (please let us know in this issue if someone read this), we should fix this, possibly in jupyter_server, or by just ignoring this particular error.

babazaroni commented 12 months ago

I checked my Jupyter Lab version again and was not even close to the latest. Something was preventing conda from installing the latest so I reinstalled conda and now am at lab version 3.5. This cleared out my initial problem.

babazaroni commented 12 months ago

The jupyter extension version is still a problem, but should have it's own issues entry.