exasol / ai-lab

Development environment for data science developers
MIT License
3 stars 0 forks source link

UI in notebooks broken. #289

Closed tomuben closed 2 months ago

tomuben commented 2 months ago

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 https://github.com/ipython/ipython/issues/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