campaslab / napari-stress

Interactive surface analysis in napari for bio-mechanical stress measurement
https://campaslab.github.io/napari-stress/
BSD 3-Clause "New" or "Revised" License
17 stars 4 forks source link

Trace-Refine Surface Points Error #160

Open carlos-gomez00 opened 1 year ago

carlos-gomez00 commented 1 year ago
--------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File ~\anaconda3\envs\napari-stress\lib\site-packages\npe2\_command_registry.py:33, in CommandHandler.resolve(self=CommandHandler(id='napari-stress.trace_refine_su...ss._refine_surfaces:trace_refinement_of_surface'))
     32 try:
---> 33     self.function = utils.import_python_name(self.python_name)
        self.function = None
        self.python_name = 'napari_stress._refine_surfaces:trace_refinement_of_surface'
        self = CommandHandler(id='napari-stress.trace_refine_surface', function=None, python_name='napari_stress._refine_surfaces:trace_refinement_of_surface')
        utils = 
     34 except Exception as e:

File ~\anaconda3\envs\napari-stress\lib\site-packages\npe2\manifest\utils.py:240, in import_python_name(python_name='napari_stress._refine_surfaces:trace_refinement_of_surface')
    238 module_name, funcname = match.groups()  # type: ignore [union-attr]
--> 240 mod = import_module(module_name)
        module_name = 'napari_stress._refine_surfaces'
    241 return getattr(mod, funcname)

File ~\anaconda3\envs\napari-stress\lib\importlib\__init__.py:127, in import_module(name='napari_stress._refine_surfaces', package=None)
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
        level = 0
        name = 'napari_stress._refine_surfaces'
        name[level:] = 'napari_stress._refine_surfaces'
        package = None
        _bootstrap = 

File :1030, in _gcd_import(name='napari_stress._refine_surfaces', package=None, level=0)

File :1007, in _find_and_load(name='napari_stress._refine_surfaces', import_=)

File :972, in _find_and_load_unlocked(name='napari_stress._refine_surfaces', import_=)

File :228, in _call_with_frames_removed(f=, *args=('napari_stress',), **kwds={})

File :1030, in _gcd_import(name='napari_stress', package=None, level=0)

File :1007, in _find_and_load(name='napari_stress', import_=)

File :986, in _find_and_load_unlocked(name='napari_stress', import_=)

File :680, in _load_unlocked(spec=ModuleSpec(name='napari_stress', loader=

File :850, in exec_module(self=, module=)

File :228, in _call_with_frames_removed(f=, *args=( at 0x0000027901D1FB30, fil...site-packages\napari_stress\__init__.py", line 1>, {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'AttributeError': , 'BaseException': , 'BlockingIOError': , 'BrokenPipeError': , 'BufferError': , 'BytesWarning': , 'ChildProcessError': , 'ConnectionAbortedError': , ...}, '__cached__': r'C:\Users\carlo\anaconda3\envs\napari-stress\lib\...napari_stress\__pycache__\__init__.cpython-39.pyc', '__doc__': None, '__file__': r'C:\Users\carlo\anaconda3\envs\napari-stress\lib\site-packages\napari_stress\__init__.py', '__loader__': , '__name__': 'napari_stress', '__package__': 'napari_stress', '__path__': [r'C:\Users\carlo\anaconda3\envs\napari-stress\lib\site-packages\napari_stress'], '__spec__': ModuleSpec(name='napari_stress', loader=

File ~\anaconda3\envs\napari-stress\lib\site-packages\napari_stress\__init__.py:3
      1 __version__ = "0.0.19"
----> 3 from . import _measurements as measurements
      4 from . import _approximation as approximation

File ~\anaconda3\envs\napari-stress\lib\site-packages\napari_stress\_measurements\__init__.py:3
      1 # -*- coding: utf-8 -*-
----> 3 from .curvature import (calculate_mean_curvature_on_manifold,
      4                         curvature_on_ellipsoid,
      5                         mean_curvature_on_ellipse_cardinal_points,
      6                         gauss_bonnet_test)
      7 from .utils import naparify_measurement

File ~\anaconda3\envs\napari-stress\lib\site-packages\napari_stress\_measurements\curvature.py:3
      1 # -*- coding: utf-8 -*-
----> 3 from .._stress import euclidian_k_form_SPB as euc_kf
      4 from .._spherical_harmonics.spherical_harmonics import get_normals_on_manifold

ModuleNotFoundError: No module named 'napari_stress._stress'

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

RuntimeError                              Traceback (most recent call last)
File ~\anaconda3\envs\napari-stress\lib\site-packages\napari\_qt\menus\plugins_menu.py:97, in PluginsMenu._add_plugin_actions.._add_toggle_widget(key=('napari-stress', 'Trace-refine surface points'), hook_type='dock')
     94     return
     96 if hook_type == 'dock':
---> 97     dock_widget, _w = self._win.add_plugin_dock_widget(*key)
        key = ('napari-stress', 'Trace-refine surface points')
        self._win = 
        self = 
     98 else:
     99     dock_widget = self._win._add_plugin_function_widget(*key)

File ~\anaconda3\envs\napari-stress\lib\site-packages\napari\_qt\qt_main_window.py:664, in Window.add_plugin_dock_widget(self=, plugin_name='napari-stress', widget_name='Trace-refine surface points')
    661 Widget = None
    662 dock_kwargs = {}
--> 664 result = _npe2.get_widget_contribution(plugin_name, widget_name)
        plugin_name = 'napari-stress'
        widget_name = 'Trace-refine surface points'
        _npe2 = 
    665 if result:
    666     Widget, widget_name = result

File ~\anaconda3\envs\napari-stress\lib\site-packages\napari\plugins\_npe2.py:108, in get_widget_contribution(plugin_name='napari-stress', widget_name='Trace-refine surface points')
    106     if contrib.plugin_name == plugin_name:
    107         if not widget_name or contrib.display_name == widget_name:
--> 108             return contrib.get_callable(), contrib.display_name
        contrib = WidgetContribution(command='napari-stress.trace_refine_surface', display_name='Trace-refine surface points', autogenerate=True)
        contrib.display_name = 'Trace-refine surface points'
    109         widgets_seen.add(contrib.display_name)
    110 if widget_name and widgets_seen:

File ~\anaconda3\envs\napari-stress\lib\site-packages\npe2\manifest\contributions\_widgets.py:50, in WidgetContribution.get_callable(self=WidgetContribution(command='napari-stress.trace_...'Trace-refine surface points', autogenerate=True), _registry=None)
     47 def get_callable(
     48     self, _registry: Optional[CommandRegistry] = None
     49 ) -> Callable[..., Widget]:
---> 50     func = super().get_callable()
     51     if self.autogenerate:
     52         try:

File ~\anaconda3\envs\napari-stress\lib\site-packages\npe2\manifest\utils.py:75, in Executable.get_callable(self=WidgetContribution(command='napari-stress.trace_...'Trace-refine surface points', autogenerate=True), _registry=)
     72     from .._plugin_manager import PluginManager
     74     _registry = PluginManager.instance().commands
---> 75 return _registry.get(self.command)
        _registry = 
        self.command = 'napari-stress.trace_refine_surface'
        self = WidgetContribution(command='napari-stress.trace_refine_surface', display_name='Trace-refine surface points', autogenerate=True)

File ~\anaconda3\envs\napari-stress\lib\site-packages\npe2\_command_registry.py:132, in CommandRegistry.get(self=, id='napari-stress.trace_refine_surface')
    130     if id not in self._commands:  # sourcery skip
    131         raise KeyError(f"command {id!r} not registered")
--> 132 return self._commands[id].resolve()
        id = 'napari-stress.trace_refine_surface'
        self._commands = {'napari-stress.rescale': CommandHandler(id='napari-stress.rescale', function=None, python_name='napari_stress._preprocess:rescale'), 'napari-stress.trace_refine_surface': CommandHandler(id='napari-stress.trace_refine_surface', function=None, python_name='napari_stress._refine_surfaces:trace_refinement_of_surface'), 'napari-stress.reconstruct_surface': CommandHandler(id='napari-stress.reconstruct_surface', function=None, python_name='napari_stress._surface:reconstruct_surface'), 'napari-stress.extract_vertex_points': CommandHandler(id='napari-stress.extract_vertex_points', function=None, python_name='napari_stress._surface:extract_vertex_points'), 'napari-stress.get_pointcloud_sample_data': CommandHandler(id='napari-stress.get_pointcloud_sample_data', function=None, python_name='napari_stress._sample_data:get_droplet_point_cloud'), 'napari-stress.get_pointcloud_sample_data_4d': CommandHandler(id='napari-stress.get_pointcloud_sample_data_4d', function=None, python_name='napari_stress._sample_data:get_droplet_point_cloud_4d'), 'napari-stress.fit_spherical_harmonics': CommandHandler(id='napari-stress.fit_spherical_harmonics', function=None, python_name='napari_stress._spherical_harmonics.spherical_harmonics_napari:fit_spherical_harmonics'), 'napari-stress.lebedev_quadrature': CommandHandler(id='napari-stress.lebedev_quadrature', function=None, python_name='napari_stress._spherical_harmonics.spherical_harmonics_napari:perform_lebedev_quadrature'), 'napari-stress.measure_curvature': CommandHandler(id='napari-stress.measure_curvature', function=None, python_name='napari_stress._measurements.curvature:calculate_mean_curvature_on_manifold'), 'napari-stress.measure_gauss_bonnet': CommandHandler(id='napari-stress.measure_gauss_bonnet', function=None, python_name='napari_stress._measurements.curvature:gauss_bonnet_test'), 'napari-stress.curvature_on_ellipsoid': CommandHandler(id='napari-stress.curvature_on_ellipsoid', function=None, python_name='napari_stress.approximation:curvature_on_ellipsoid'), 'napari-stress.measure_anisotropic_stresses': CommandHandler(id='napari-stress.measure_anisotropic_stresses', function=None, python_name='napari_stress._measurements.stresses:tissue_and_cell_scale_stress'), 'napari-stress.stress_analysis_toolbox': CommandHandler(id='napari-stress.stress_analysis_toolbox', function=None, python_name='napari_stress._measurements.toolbox:stress_analysis_toolbox'), 'napari-stress.fit_ellipsoid_points': CommandHandler(id='napari-stress.fit_ellipsoid_points', function=None, python_name='napari_stress._surface:fit_ellipsoid_to_pointcloud_points'), 'napari-stress.fit_ellipsoid_vectors': CommandHandler(id='napari-stress.fit_ellipsoid_vectors', function=None, python_name='napari_stress._surface:fit_ellipsoid_to_pointcloud_vectors'), 'napari-stress.features_histogram': CommandHandler(id='napari-stress.features_histogram', function=None, python_name='napari_stress:FeaturesHistogramWidget'), 'napari-stress.fit_lsq_ellipsoid': CommandHandler(id='napari-stress.fit_lsq_ellipsoid', function=None, python_name='napari_stress.approximation:least_squares_ellipsoid'), 'napari-stress.expand_ellipsoid': CommandHandler(id='napari-stress.expand_ellipsoid', function=None, python_name='napari_stress.approximation:expand_points_on_ellipse'), 'napari-stress.pairwise_distance': CommandHandler(id='napari-stress.pairwise_distance', function=None, python_name='napari_stress.approximation:pairwise_point_distances')}
        self = 
        self._commands[id] = CommandHandler(id='napari-stress.trace_refine_surface', function=None, python_name='napari_stress._refine_surfaces:trace_refinement_of_surface')

File ~\anaconda3\envs\napari-stress\lib\site-packages\npe2\_command_registry.py:35, in CommandHandler.resolve(self=CommandHandler(id='napari-stress.trace_refine_su...ss._refine_surfaces:trace_refinement_of_surface'))
     33     self.function = utils.import_python_name(self.python_name)
     34 except Exception as e:
---> 35     raise RuntimeError(
     36         f"Failed to import command at {self.python_name!r}: {e}"
     37     ) from e
     39 return self.function

RuntimeError: Failed to import command at 'napari_stress._refine_surfaces:trace_refinement_of_surface': No module named 'napari_stress._stress'
jo-mueller commented 1 year ago

When downloading the package from pypi , I noticed that some folders (and thus, some code) is missing. I added ___init__.py files in the directories and will create a new release - let's hope this resolves the issue.

jo-mueller commented 1 year ago

@carlos-gomez00 This should work in recent releases, right? Can I close this?