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

UI in notebooks broken. #289

Closed
tomuben opened this issue Jun 17, 2024 · 0 comments · Fixed by #290
Closed

UI in notebooks broken. #289

tomuben opened this issue Jun 17, 2024 · 0 comments · Fixed by #290
Assignees
Labels
bug Unwanted / harmful behavior

Comments

@tomuben
Copy link
Contributor

tomuben commented Jun 17, 2024

When trying to run the UI in notebooks I get the following error:
Running:

%run ../utils/access_store_ui.ipynb
display(get_access_store_ui('../'))

shows

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 2
      1 get_ipython().run_line_magic('run', '../utils/access_store_ui.ipynb')
----> 2 display(get_access_store_ui('../'))

File /tmp/ipykernel_1425/3746167459.py:12, in get_access_store_ui(root_dir)
      8 def get_access_store_ui(root_dir: str = '.') -> widgets.Widget:
      9 
     10     # Try to find the file name in the shared store.
     11     # Create a global variable only temporarily.
---> 12     get_ipython().run_line_magic('store', '-r')
     13     if 'sb_store_file' in globals():
     14         global sb_store_file

File ~/jupyterenv/lib/python3.10/site-packages/IPython/core/interactiveshell.py:2480, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2478     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2479 with self.builtin_trap:
-> 2480     result = fn(*args, **kwargs)
   2482 # The code below prevents the output from being displayed
   2483 # when using magics with decorator @output_can_be_silenced
   2484 # when the last Python token in the expression is a ';'.
   2485 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File ~/jupyterenv/lib/python3.10/site-packages/IPython/extensions/storemagic.py:157, in StoreMagics.store(self, parameter_s)
    155                 ip.user_ns[arg] = obj
    156     else:
--> 157         restore_data(ip)
    159 # run without arguments -> list variables & values
    160 elif not args:

File ~/jupyterenv/lib/python3.10/site-packages/IPython/extensions/storemagic.py:55, in restore_data(ip)
     54 def restore_data(ip):
---> 55     refresh_variables(ip)
     56     restore_aliases(ip)
     57     restore_dhist(ip)

File ~/jupyterenv/lib/python3.10/site-packages/IPython/extensions/storemagic.py:37, in refresh_variables(ip)
     35 def refresh_variables(ip):
     36     db = ip.db
---> 37     for key in db.keys('autorestore/*'):
     38         # strip autorestore
     39         justkey = os.path.basename(key)
     40         try:

AttributeError: 'PickleShareDB' object has no attribute 'keys'

Looks like this related to ipython/ipython#14367

Fix

The first suggested solution does not work (we are already on latest version of ipython 8.25.0).
=> We need to add pickleshare as explicit dependency.

See #291

@tomuben tomuben added the bug Unwanted / harmful behavior label Jun 17, 2024
@tomuben tomuben self-assigned this Jun 17, 2024
tomuben added a commit that referenced this issue Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted / harmful behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant