It has been resolved in Jupyter Lab, however, setting options still appends newly set options when using voila-preview.
NOTE: The only oddity I have noticed from debugging is that there is a traceback when running jupyter lab --debug due to jupyter_server which may be the potential cause of this? I have pasted the output of this under Command Line Output below in the Context section.
import ipywidgets as w
from random import randint
class TestUi(w.HBox):
"""Clicking button creates new random options of length 5
and sets it to combobox."""
def __init__(self):
super().__init__()
self.combobox = w.Combobox()
self.btn = w.Button(description="Set Options")
self.children = [self.btn, self.combobox]
self.btn.on_click(self.set_options)
def set_options(self, on_click):
self.combobox.options = [str(randint(1, 20)) for i in range(5)]
if __name__ == "__main__":
display(TestUi())
^This simple script sets a list of length 5 of random numbers to the combobox options when clicking on the "Set Options" button.
Running In JupyterLab (Expected Behaviour)
After clicking "Set Options" button once:
Clicking a second time:
This is the expected behaviour as we can see that the newly set options replace the old options.
Running In Voila (Unexpected Behaviour)
Click "Set Options" button once:
Clicking a second time:
As we can see, the newly set list is appended which is contradictory to the behaviour when running in Jupyter Lab.
Expected behaviour
Expect the newly set options to replace the previous options when using voila-preview.
Context
ipywidgets version: 8.0.6
Operating System and version: Ubuntu 20.04 LTS
Browser and version: Google Chrome Version 111.0.5563.147 (Official Build) (64-bit)
# packages in environment at /home/jovyan/mambaforge/envs/ipywidgets-test:
#
# Name Version Build Channel
jupyterlab 3.5.0 pyhd8ed1ab_0 conda-forge
jupyterlab-widgets 3.0.7 pypi_0 pypi
jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_server 2.22.0 pyhd8ed1ab_0 conda-forge
(ipywidgets-test) jovyan@PORT3010:/mnt/c/engDev/git_mf/voila_issue$ jupyter lab --debug
[D 2023-04-04 12:29:57.932 ServerApp] Searching ['/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter', '/home/jovyan/.jupyter', '/home/jovyan/.local/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[D 2023-04-04 12:29:57.932 ServerApp] Looking for jupyter_config in /etc/jupyter
[D 2023-04-04 12:29:57.933 ServerApp] Looking for jupyter_config in /usr/local/etc/jupyter
[D 2023-04-04 12:29:57.933 ServerApp] Looking for jupyter_config in /home/jovyan/.local/etc/jupyter
[D 2023-04-04 12:29:57.933 ServerApp] Looking for jupyter_config in /home/jovyan/.jupyter
[D 2023-04-04 12:29:57.933 ServerApp] Looking for jupyter_config in /home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter
[D 2023-04-04 12:29:57.933 ServerApp] Looking for jupyter_server_config in /etc/jupyter
[D 2023-04-04 12:29:57.934 ServerApp] Looking for jupyter_server_config in /usr/local/etc/jupyter
[D 2023-04-04 12:29:57.934 ServerApp] Looking for jupyter_server_config in /home/jovyan/.local/etc/jupyter
[D 2023-04-04 12:29:57.934 ServerApp] Looking for jupyter_server_config in /home/jovyan/.jupyter
[D 2023-04-04 12:29:57.934 ServerApp] Looking for jupyter_server_config in /home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter
[D 2023-04-04 12:29:57.935 ServerApp] Paths used for configuration of jupyter_server_config:
/etc/jupyter/jupyter_server_config.json
[D 2023-04-04 12:29:57.935 ServerApp] Paths used for configuration of jupyter_server_config:
/usr/local/etc/jupyter/jupyter_server_config.json
[D 2023-04-04 12:29:57.935 ServerApp] Paths used for configuration of jupyter_server_config:
/home/jovyan/.local/etc/jupyter/jupyter_server_config.json
[D 2023-04-04 12:29:57.936 ServerApp] Paths used for configuration of jupyter_server_config:
/home/jovyan/.jupyter/jupyter_server_config.json
[D 2023-04-04 12:29:57.936 ServerApp] Paths used for configuration of jupyter_server_config:
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_server_config.d/jupyter_server_terminals.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_server_config.d/jupyterlab.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_server_config.d/nbclassic.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_server_config.d/notebook_shim.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_server_config.d/voila.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_server_config.json
[W 2023-04-04 12:29:57.936 ServerApp] jupyter_server_terminals | error adding extension (enabled: True): Jupyter Server Terminals requires Jupyter Server 2.0+
Traceback (most recent call last):
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 320, in add_extension
extpkg = ExtensionPackage(name=extension_name, enabled=enabled)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 166, in __init__
super().__init__(*args, **kwargs)
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/traitlets/traitlets.py", line 1361, in __init__
value = self._traits[key]._cross_validate(self, getattr(self, key))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/traitlets/traitlets.py", line 746, in _cross_validate
value = obj._trait_validators[self.name](obj, proposal)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/traitlets/traitlets.py", line 1233, in __call__
return self.func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 175, in _validate_name
self._module, self._metadata = get_metadata(name)
^^^^^^^^^^^^^^^^^^
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/jupyter_server/extension/utils.py", line 60, in get_metadata
module = importlib.import_module(package_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/jupyter_server_terminals/__init__.py", line 9, in
raise RuntimeError("Jupyter Server Terminals requires Jupyter Server 2.0+")
RuntimeError: Jupyter Server Terminals requires Jupyter Server 2.0+
[D 2023-04-04 12:29:58.096 LabApp] Config changed: {'NotebookApp': {}, 'ServerApp': {'log_level': 'DEBUG', 'jpserver_extensions': }, 'ExtensionApp': {'log_level': 'DEBUG'}}
[I 2023-04-04 12:29:58.097 ServerApp] jupyterlab | extension was successfully linked.
[D 2023-04-04 12:29:58.100 NotebookApp] Config changed: {'NotebookApp': {}, 'ServerApp': {'log_level': 'DEBUG', 'jpserver_extensions': }, 'ExtensionApp': {'log_level': 'DEBUG'}}
[I 2023-04-04 12:29:58.100 ServerApp] nbclassic | extension was successfully linked.
[D 2023-04-04 12:29:58.330 ServerApp] Paths used for configuration of jupyter_notebook_config:
/home/jovyan/.jupyter/jupyter_notebook_config.json
[D 2023-04-04 12:29:58.330 ServerApp] Paths used for configuration of jupyter_notebook_config:
/etc/jupyter/jupyter_notebook_config.json
[D 2023-04-04 12:29:58.330 ServerApp] Paths used for configuration of jupyter_notebook_config:
/usr/local/etc/jupyter/jupyter_notebook_config.json
[D 2023-04-04 12:29:58.330 ServerApp] Paths used for configuration of jupyter_notebook_config:
/home/jovyan/.local/etc/jupyter/jupyter_notebook_config.json
[D 2023-04-04 12:29:58.330 ServerApp] Paths used for configuration of jupyter_notebook_config:
/home/jovyan/.jupyter/jupyter_notebook_config.json
[D 2023-04-04 12:29:58.331 ServerApp] Paths used for configuration of jupyter_notebook_config:
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_notebook_config.d/jupyterlab.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_notebook_config.d/voila.json
/home/jovyan/mambaforge/envs/ipywidgets-test/etc/jupyter/jupyter_notebook_config.json
[I 2023-04-04 12:29:58.331 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-04-04 12:29:58.331 ServerApp] voila.server_extension | extension was successfully linked.
[D 2023-04-04 12:29:58.332 ServerApp] Config changed: {'ExtensionApp': {'log_level': 'DEBUG'}, 'NotebookApp': {}, 'ServerApp': {'log_level': 'DEBUG', 'jpserver_extensions': }}
[D 2023-04-04 12:29:58.332 ServerApp] Raising open file limit: soft 1024->4096; hard 4096->4096
[I 2023-04-04 12:29:58.345 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-04-04 12:29:58.345 LabApp] JupyterLab extension loaded from /home/jovyan/mambaforge/envs/ipywidgets-test/lib/python3.11/site-packages/jupyterlab
[I 2023-04-04 12:29:58.345 LabApp] JupyterLab application directory is /home/jovyan/mambaforge/envs/ipywidgets-test/share/jupyter/lab
[I 2023-04-04 12:29:58.347 ServerApp] jupyterlab | extension was successfully loaded.
_ _ _ _
| | | |_ __ __| |__ _| |_ ___
| |_| | '_ \/ _` / _` | _/ -_)
\___/| .__/\__,_\__,_|\__\___|
|_|
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.
https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html
Please note that updating to Notebook 7 might break some of your extensions.
[I 2023-04-04 12:29:58.349 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-04-04 12:29:58.351 ServerApp] voila.server_extension | extension was successfully loaded.
[I 2023-04-04 12:29:58.352 ServerApp] Serving notebooks from local directory: /mnt/c/engDev/git_mf/voila_issue
[I 2023-04-04 12:29:58.352 ServerApp] Jupyter Server 1.23.6 is running at:
[I 2023-04-04 12:29:58.352 ServerApp] http://localhost:8888/lab?token=6fe8fc9e4a051344ab87fffcf3483b5d01e0c8be626633db
[I 2023-04-04 12:29:58.352 ServerApp] or http://127.0.0.1:8888/lab?token=6fe8fc9e4a051344ab87fffcf3483b5d01e0c8be626633db
[I 2023-04-04 12:29:58.352 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-04-04 12:29:58.638 ServerApp]
To access the server, open this file in a browser:
file:///home/jovyan/.local/share/jupyter/runtime/jpserver-12895-open.html
Or copy and paste one of these URLs:
http://localhost:8888/lab?token=6fe8fc9e4a051344ab87fffcf3483b5d01e0c8be626633db
or http://127.0.0.1:8888/lab?token=6fe8fc9e4a051344ab87fffcf3483b5d01e0c8be626633db
Start : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1
+ Start "file:///home/jovyan/.local/share/jupyter/runtime/jpserver-1289 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Browser Output
An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can remove its sandboxing.
If using JupyterLab
JupyterLab version: 3.5.0
Installed Labextensions
JupyterLab v3.5.0
/home/jovyan/mambaforge/envs/ipywidgets-test/share/jupyter/labextensions
jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
@jupyter-widgets/jupyterlab-manager v5.0.7 enabled OK (python, jupyterlab_widgets)
@voila-dashboards/jupyterlab-preview v2.2.0 enabled OK (python, voila)
This requires a new release of voila since it bundles the base and control packages. A future version of voila will not do that, and pick the version installed from ipywidgets.
Description
This bug is in relation to https://github.com/jupyter-widgets/ipywidgets/issues/3681.
It has been resolved in Jupyter Lab, however, setting options still appends newly set options when using voila-preview.
NOTE: The only oddity I have noticed from debugging is that there is a traceback when running
jupyter lab --debug
due to jupyter_server which may be the potential cause of this? I have pasted the output of this underCommand Line Output
below in the Context section.Reproduce
Installed ipywidgets-test env following:
And installed voila using:
The voila version installed is 0.4.0.
Output From Installing Voila
Created test script to show behaviour:
^This simple script sets a list of length 5 of random numbers to the combobox options when clicking on the "Set Options" button.
Running In JupyterLab (Expected Behaviour)
After clicking "Set Options" button once:
Clicking a second time:
This is the expected behaviour as we can see that the newly set options replace the old options.
Running In Voila (Unexpected Behaviour)
Click "Set Options" button once:
Clicking a second time:
As we can see, the newly set list is appended which is contradictory to the behaviour when running in Jupyter Lab.
Expected behaviour
Expect the newly set options to replace the previous options when using voila-preview.
Context
Troubleshoot Output
Command Line Output
Browser Output
If using JupyterLab
Installed Labextensions