Closed jcohenadad closed 1 year ago
File ~/code/napari-plugin/napari-ADS/napari_ADS/_widget.py:6 4 from pathlib import Path ----> 6 import config 7 import numpy as np
RuntimeError: Failed to import command at 'napari_ADS._widget:ADSplugin': No module named 'config'
This import line tries to import config.py from AxonDeepSeg. It is possible that AxonDeepSeg was not properly installed.
@jcohenadad Could you type axondeepseg_test
in a terminal with the anaconda environment activated which you used for the installation of the napari plugin?
That being said, I don't like the fact that the config file looks like it comes outside of the AxonDeepSeg project as it could be missleading in situations like this one. Thus, I will open an issue on the main AxonDeepSeg github project to address this.
Hum, I guess you're right, probably not properly installed:
julien-macbook:~ $ conda activate ads_venv_napari
(ads_venv_napari) julien-macbook:~ $ axondeepseg_test
-bash: axondeepseg_test: command not found
Reinstalling:
and... the plugin now works like a charm 😊
I will be testing it now. Thank you for your excellent support @Stoyan-I-A 🙏
I guess we can close, it was probably a glitch in the installation?
I guess we can close, it was probably a glitch in the installation?
Not sure, but I'm glad you managed to make it work 🙂
After a fresh installation of napari following https://github.com/axondeepseg/napari-plugin#instructions-to-install-the-plugin, I launch napari and click on the ADS plugin, and observe the following error
Terminal output
```console --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/npe2/_command_registry.py:33, in CommandHandler.resolve(self=CommandHandler(id='napari-ADS.make_qwidget', fun...None, python_name='napari_ADS._widget:ADSplugin')) 32 try: ---> 33 self.function = utils.import_python_name(self.python_name) self.function = None self.python_name = 'napari_ADS._widget:ADSplugin' self = CommandHandler(id='napari-ADS.make_qwidget', function=None, python_name='napari_ADS._widget:ADSplugin') utils =at 0x7fd7b29712f0, file "/...lugin/napari-ADS/napari_ADS/__init__.py", line 1>, {'__builtins__': {'ArithmeticError':, 'AssertionError': , 'AttributeError': , 'BaseException': , 'BlockingIOError': , 'BrokenPipeError': , 'BufferError': , 'BytesWarning': , 'ChildProcessError': , 'ConnectionAbortedError': , ...}, '__cached__': '/Users/julien/code/napari-plugin/napari-ADS/napari_ADS/__pycache__/__init__.cpython-38.pyc', '__doc__': None, '__file__': '/Users/julien/code/napari-plugin/napari-ADS/napari_ADS/__init__.py', '__loader__': <_frozen_importlib_external.SourceFileLoader object>, '__name__': 'napari_ADS', '__package__': 'napari_ADS', '__path__': ['/Users/julien/code/napari-plugin/napari-ADS/napari_ADS'], '__spec__': ModuleSpec(name='napari_ADS', loader=<_frozen_im...ulien/code/napari-plugin/napari-ADS/napari_ADS']), '__version__': '0.0.1'}), **kwds={})
File ~/code/napari-plugin/napari-ADS/napari_ADS/__init__.py:3
1 __version__ = "0.0.1"
----> 3 from ._widget import ADSplugin
5 __all__ = (
6 "ADSplugin"
7 )
File ~/code/napari-plugin/napari-ADS/napari_ADS/_widget.py:6
4 from pathlib import Path
----> 6 import config
7 import numpy as np
ModuleNotFoundError: No module named 'config'
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/napari/_qt/menus/plugins_menu.py:99, in PluginsMenu._add_plugin_actions.._add_toggle_widget(key=('napari-ADS', 'ADS plugin'), hook_type='dock')
96 return
98 if hook_type == 'dock':
---> 99 self._win.add_plugin_dock_widget(*key)
key = ('napari-ADS', 'ADS plugin')
self._win =
self =
100 else:
101 self._win._add_plugin_function_widget(*key)
File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/napari/_qt/qt_main_window.py:696, in Window.add_plugin_dock_widget(self=, plugin_name='napari-ADS', widget_name='ADS plugin', tabify=False)
693 Widget = None
694 dock_kwargs = {}
--> 696 if result := _npe2.get_widget_contribution(plugin_name, widget_name):
widget_name = 'ADS plugin'
plugin_name = 'napari-ADS'
_npe2 =
697 Widget, widget_name = result
699 if Widget is None:
File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/napari/plugins/_npe2.py:125, in get_widget_contribution(plugin_name='napari-ADS', widget_name='ADS plugin')
123 if contrib.plugin_name == plugin_name:
124 if not widget_name or contrib.display_name == widget_name:
--> 125 return contrib.get_callable(), contrib.display_name
contrib = WidgetContribution(command='napari-ADS.make_qwidget', display_name='ADS plugin', autogenerate=False)
contrib.display_name = 'ADS plugin'
126 widgets_seen.add(contrib.display_name)
127 if widget_name and widgets_seen:
File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/npe2/manifest/contributions/_widgets.py:50, in WidgetContribution.get_callable(self=WidgetContribution(command='napari-ADS.make_qwidget', display_name='ADS plugin', autogenerate=False), _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 ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/npe2/manifest/utils.py:72, in Executable.get_callable(self=WidgetContribution(command='napari-ADS.make_qwidget', display_name='ADS plugin', autogenerate=False), _registry=)
69 from .._plugin_manager import PluginManager
71 _registry = PluginManager.instance().commands
---> 72 return _registry.get(self.command)
_registry =
self.command = 'napari-ADS.make_qwidget'
self = WidgetContribution(command='napari-ADS.make_qwidget', display_name='ADS plugin', autogenerate=False)
File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/npe2/_command_registry.py:132, in CommandRegistry.get(self=, id='napari-ADS.make_qwidget')
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-ADS.make_qwidget'
self._commands = {'napari-ADS.make_qwidget': CommandHandler(id='napari-ADS.make_qwidget', function=None, python_name='napari_ADS._widget:ADSplugin')}
self =
self._commands[id] = CommandHandler(id='napari-ADS.make_qwidget', function=None, python_name='napari_ADS._widget:ADSplugin')
File ~/miniconda3/envs/ads_venv_napari/lib/python3.8/site-packages/npe2/_command_registry.py:35, in CommandHandler.resolve(self=CommandHandler(id='napari-ADS.make_qwidget', fun...None, python_name='napari_ADS._widget:ADSplugin'))
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_ADS._widget:ADSplugin': No module named 'config'
```