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

With shinywidgets, RuntimeError: module 'ipykernel' has no attribute 'version_info' #20

Open
psychemedia opened this issue Jan 22, 2025 · 0 comments

Comments

@psychemedia
Copy link
Contributor

Tryin to run the widget with shinywidgets in a shinylive app:

Error starting app!
Traceback (most recent call last):
  File "/lib/python3.12/site-packages/traitlets/traitlets.py", line 632, in get
    value = obj._trait_values[self.name]
            ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'layout'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/lib/python3.12/site-packages/ipywidgets/widgets/widget.py", line 615, in get_state
    value = to_json(getattr(self, k), self)
                    ^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/traitlets/traitlets.py", line 687, in __get__
    return t.cast(G, self.get(obj, cls))  # the G should encode the Optional
                     ^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/traitlets/traitlets.py", line 635, in get
    default = obj.trait_defaults(self.name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/traitlets/traitlets.py", line 1897, in trait_defaults
    return t.cast(Sentinel, self._get_trait_default_generator(names[0])(self))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/traitlets/traitlets.py", line 602, in default
    return t.cast(G, self.make_dynamic_default())
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/ipywidgets/widgets/trait_types.py", line 409, in make_dynamic_default
    return self.klass(*(self.default_args or ()),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/ipywidgets/widgets/widget_layout.py", line 86, in __init__
    super().__init__(**kwargs)
  File "/lib/python3.12/site-packages/ipywidgets/widgets/widget.py", line 506, in __init__
    self.open()
  File "/lib/python3.12/site-packages/ipywidgets/widgets/widget.py", line 535, in open
    self.comm = comm.create_comm(**args)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/ipywidgets/comm.py", line 28, in create_comm
    if requires_ipykernel_shim():
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/ipywidgets/comm.py", line 11, in requires_ipykernel_shim
    version = ipykernel.version_info
              ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'ipykernel' has no attribute 'version_info'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<exec>", line 393, in _start_app
  File "<exec>", line 366, in __init__
  File "/lib/python3.12/site-packages/shiny/express/_run.py", line 62, in wrap_express_app
    app_module = importlib.import_module(package_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python312.zip/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/lib/python3.12/site-packages/shiny/express/_run.py", line 102, in exec_module
    module.app = create_express_app(  # pyright: ignore[reportAttributeAccessIssue]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/shiny/express/_run.py", line 132, in create_express_app
    app_ui = run_express(file, package_name).tagify()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/shiny/express/_run.py", line 255, in run_express
    raise RuntimeError(e) from e
RuntimeError: module 'ipykernel' has no attribute 'version_info'

A similar issue seems to have occurred elsewhere in the past jupyter-widgets/ipywidgets#3819 .

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

1 participant