magland / sortingview

Web app for viewing results of ephys spike sorting
Apache License 2.0
23 stars 7 forks source link

Error when displaying in Jupyter notebook #220

Open alejoe91 opened 1 year ago

alejoe91 commented 1 year ago

Hi @magland @jsoules

Related to https://github.com/flatironinstitute/kachery-cloud/issues/22, when generating a view in Jupyter and running it in a jupyter cell (aka display(view)), an error related to figurl-jupyter is triggered.

Can you either update figurl-jupyter or remove the display option here?

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File ~/anaconda3/envs/si/lib/python3.9/site-packages/IPython/core/formatters.py:921, in IPythonDisplayFormatter.__call__(self, obj)
    919 method = get_real_method(obj, self.print_method)
    920 if method is not None:
--> 921     method()
    922     return True

File ~/anaconda3/envs/si/lib/python3.9/site-packages/sortingview/views/View.py:120, in View._ipython_display_(self)
    118 def _ipython_display_(self):
    119     from IPython.display import display
--> 120     ipywidget = self.jupyter(height=self._height)
    121     self._set_jupyter_widget(ipywidget)
    122     display(ipywidget)

File ~/anaconda3/envs/si/lib/python3.9/site-packages/sortingview/views/View.py:100, in View.jupyter(self, height)
     98 if height is None:
     99     height = self._height
--> 100 import figurl_jupyter as fj
    101 url = self.url(label='jupyter', local=True, electron=False, listen_port=None)
    102 a = _parse_figurl_url(url)

File ~/anaconda3/envs/si/lib/python3.9/site-packages/figurl_jupyter/__init__.py:7
      1 #!/usr/bin/env python
      2 # coding: utf-8
      3 
      4 # Copyright (c) Jeremy Magland.
      5 # Distributed under the terms of the Modified BSD License.
----> 7 from .FigurlFigure import FigurlFigure
      8 from ._version import __version__, version_info
     10 def _jupyter_labextension_paths():

File ~/anaconda3/envs/si/lib/python3.9/site-packages/figurl_jupyter/FigurlFigure.py:17
     15 import kachery_cloud as kcl
     16 from ._frontend import module_name, module_version
---> 17 from kachery_cloud.TaskBackend.TaskBackend import TaskHandler
     18 from kachery_cloud._json_stringify_deterministic import _json_stringify_deterministic
     19 from kachery_cloud._serialize import _serialize

ModuleNotFoundError: No module named 'kachery_cloud.TaskBackend'

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File ~/anaconda3/envs/si/lib/python3.9/site-packages/IPython/core/formatters.py:973, in MimeBundleFormatter.__call__(self, obj, include, exclude)
    970     method = get_real_method(obj, self.print_method)
    972     if method is not None:
--> 973         return method(include=include, exclude=exclude)
    974     return None
    975 else:

File ~/anaconda3/envs/si/lib/python3.9/site-packages/sortingview/views/View.py:113, in View._repr_mimebundle_(self, **kwargs)
    112 def _repr_mimebundle_(self, **kwargs):
--> 113     ipywidget = self.jupyter(height=self._height)
    114     data = ipywidget._repr_mimebundle_(**kwargs)
    115     self._set_jupyter_widget(ipywidget)

File ~/anaconda3/envs/si/lib/python3.9/site-packages/sortingview/views/View.py:100, in View.jupyter(self, height)
     98 if height is None:
     99     height = self._height
--> 100 import figurl_jupyter as fj
    101 url = self.url(label='jupyter', local=True, electron=False, listen_port=None)
    102 a = _parse_figurl_url(url)

File ~/anaconda3/envs/si/lib/python3.9/site-packages/figurl_jupyter/__init__.py:7
      1 #!/usr/bin/env python
      2 # coding: utf-8
      3 
      4 # Copyright (c) Jeremy Magland.
      5 # Distributed under the terms of the Modified BSD License.
----> 7 from .FigurlFigure import FigurlFigure
      8 from ._version import __version__, version_info
     10 def _jupyter_labextension_paths():

File ~/anaconda3/envs/si/lib/python3.9/site-packages/figurl_jupyter/FigurlFigure.py:17
     15 import kachery_cloud as kcl
     16 from ._frontend import module_name, module_version
---> 17 from kachery_cloud.TaskBackend.TaskBackend import TaskHandler
     18 from kachery_cloud._json_stringify_deterministic import _json_stringify_deterministic
     19 from kachery_cloud._serialize import _serialize

ModuleNotFoundError: No module named 'kachery_cloud.TaskBackend'
magland commented 1 year ago

@alejoe91 I disabled jupyter in #221.

When you have a chance, could you test the main branch to see that it now works properly? Then I will push to pypi.