notebook-molecular-visualization icon indicating copy to clipboard operation
notebook-molecular-visualization copied to clipboard

Problems rendering jupyter notebook widget

Open psychemedia opened this issue 6 years ago • 0 comments

I've just done a clean install using the repo versions of notebook-molecular-visualization and molviz under conda py3 and I'm getting various issues.

Most notably, the widget doesn't render - browser console shows:

manager-base.js:57 Could not instantiate widget
(anonymous) @ manager-base.js:57
step @ manager.js:196
(anonymous) @ manager.js:177
rejected @ manager.js:169
utils.js:8 Error: Could not create a model.
    at promiseRejection (utils.js:8)
promiseRejection @ utils.js:8
2kernel.js:924 Couldn't process kernel message Error: Script error for "nbmolviz-js"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=6da8be361b9ee26c5e721e76c6d4afce:165)
    at HTMLScriptElement.onScriptError (require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1732)
(anonymous) @ kernel.js:924
OpenLearn.ipynb:1 Uncaught (in promise) Error: Script error for "nbmolviz-js"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=6da8be361b9ee26c5e721e76c6d4afce:165)
    at HTMLScriptElement.onScriptError (require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1732)

After importing the nbmolviz (and viewer) python package, this error also appears when I run notebook cells:

Error in callback <function _capture_logging_displays at 0x10c5ff158> (for pre_run_cell):
---------------------------------------------------------------------------
TraitError                                Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/nbmolviz/uielements/logwidget.py in _capture_logging_displays(display, **kwargs)
    192     if widgets_enabled:
    193         _current_tabs = LoggingTabs(OrderedDict(x=ipy.Box()), display=display,
--> 194                                     **wu.process_widget_kwargs(kwargs))
    195     else:
    196         _current_tabs = None

~/anaconda3/lib/python3.6/site-packages/nbmolviz/uielements/logwidget.py in __init__(self, objects, display, **kwargs)
    133             super(LoggingTabs, self).__init__(list(objects.values()),
    134                                               **wu.process_widget_kwargs(kwargs))
--> 135             self.selected_index = -1
    136             for ikey, key in enumerate(objects.keys()):
    137                 self.set_title(ikey, key)

~/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py in __set__(self, obj, value)
    583             raise TraitError('The "%s" trait is read-only.' % self.name)
    584         else:
--> 585             self.set(obj, value)
    586 
    587     def _validate(self, obj, value):

~/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py in set(self, obj, value)
    557 
    558     def set(self, obj, value):
--> 559         new_value = self._validate(obj, value)
    560         try:
    561             old_value = obj._trait_values[self.name]

~/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py in _validate(self, obj, value)
    591             value = self.validate(obj, value)
    592         if obj._cross_validation_lock is False:
--> 593             value = self._cross_validate(obj, value)
    594         return value
    595 

~/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py in _cross_validate(self, obj, value)
    597         if self.name in obj._trait_validators:
    598             proposal = Bunch({'trait': self, 'value': value, 'owner': obj})
--> 599             value = obj._trait_validators[self.name](obj, proposal)
    600         elif hasattr(obj, '_%s_validate' % self.name):
    601             meth_name = '_%s_validate' % self.name

~/anaconda3/lib/python3.6/site-packages/traitlets/traitlets.py in __call__(self, *args, **kwargs)
    905         """Pass `*args` and `**kwargs` to the handler's function if it exists."""
    906         if hasattr(self, 'func'):
--> 907             return self.func(*args, **kwargs)
    908         else:
    909             return self._init_call(*args, **kwargs)

~/anaconda3/lib/python3.6/site-packages/ipywidgets/widgets/widget_selectioncontainer.py in _validated_index(self, proposal)
     28             return proposal.value
     29         else:
---> 30             raise TraitError('Invalid selection: index out of bounds')
     31 
     32     # Public methods

TraitError: Invalid selection: index out of bounds

psychemedia avatar Apr 20 '18 10:04 psychemedia