"No Controller found for widget controller"

Hello @ranranking @benedictdied

Was able to get the Imswitch GUI installed properly after switching my python version from 3.9 to 3.10. I have now run into the problem below here saying no controller found for widget controller. The files it directs me to has been changed very recently so I am wondering if this is a hardware issue on my end or a software issue? How should I solve this? I have included the code below.

2024-07-09 13:05:49 ERROR [main] Failed to initialize module imcontrol
ERROR:imswitch:[main] Failed to initialize module imcontrol
2024-07-09 13:05:49 ERROR [main] No controller found for widget Positioner
ERROR:imswitch:[main] No controller found for widget Positioner
2024-07-09 13:05:49 ERROR [main] Traceback (most recent call last):
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\ImConMainController.py”, line 57, in init
self.controllers[widgetKey] = self.__factory.createController(
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\controller\basecontrollers.py”, line 46, in createController
controller = controllerClass(*self.__args, *args,
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\controllers\PositionerController.py”, line 29, in init
self._widget.addPositioner(pName, pManager.axes, hasSpeed, hasHome, hasStop)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets\PositionerWidget.py”, line 43, in addPositioner
self.axes.append(axis)
AttributeError: ‘PositionerWidget’ object has no attribute ‘axes’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch_main.py", line 91, in main
view, controller = modulePkg.getMainViewAndController(
File "C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol
init.py", line 62, in getMainViewAndController
raise e
File "C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol
init_.py”, line 58, in getMainViewAndController
controller = ImConMainController(options, setupInfo, view, moduleCommChannel)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\ImConMainController.py”, line 73, in init
raise ValueError(f’No controller found for widget {widgetKey}')
ValueError: No controller found for widget Positioner

ERROR:imswitch:[main] Traceback (most recent call last):
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\ImConMainController.py”, line 57, in init
self.controllers[widgetKey] = self.__factory.createController(
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\controller\basecontrollers.py”, line 46, in createController
controller = controllerClass(*self.__args, *args,
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\controllers\PositionerController.py”, line 29, in init
self._widget.addPositioner(pName, pManager.axes, hasSpeed, hasHome, hasStop)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets\PositionerWidget.py”, line 43, in addPositioner
self.axes.append(axis)
AttributeError: ‘PositionerWidget’ object has no attribute ‘axes’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch_main.py", line 91, in main
view, controller = modulePkg.getMainViewAndController(
File "C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol
init.py", line 62, in getMainViewAndController
raise e
File "C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol
init_.py”, line 58, in getMainViewAndController
controller = ImConMainController(options, setupInfo, view, moduleCommChannel)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\ImConMainController.py”, line 73, in init
raise ValueError(f’No controller found for widget {widgetKey}')
ValueError: No controller found for widget Positioner

C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\view\guitools\naparitools.py:99: FutureWarning: Public access to Window.qt_viewer is deprecated and will be removed in
v0.6.0. It is considered an “implementation detail” of the napari
application, not part of the napari viewer model. If your use case
requires access to qt_viewer, please open an issue to discuss.
napariViewer.window.qt_viewer.dockLayerList
C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\view\guitools\naparitools.py:102: FutureWarning: Public access to Window.qt_viewer is deprecated and will be removed in
v0.6.0. It is considered an “implementation detail” of the napari
application, not part of the napari viewer model. If your use case
requires access to qt_viewer, please open an issue to discuss.
napariViewer.window.qt_viewer.dockLayerList.qt_area,
C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\view\guitools\naparitools.py:103: FutureWarning: Public access to Window.qt_viewer is deprecated and will be removed in
v0.6.0. It is considered an “implementation detail” of the napari
application, not part of the napari viewer model. If your use case
requires access to qt_viewer, please open an issue to discuss.
napariViewer.window.qt_viewer.dockLayerList
C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\view\guitools\naparitools.py:105: FutureWarning: Public access to Window.qt_viewer is deprecated and will be removed in
v0.6.0. It is considered an “implementation detail” of the napari
application, not part of the napari viewer model. If your use case
requires access to qt_viewer, please open an issue to discuss.
napariViewer.window.qt_viewer.dockLayerList.show()
2024-07-09 13:05:51 DEBUG [ImRecMainViewController] Updating pattern
DEBUG:imswitch:[ImRecMainViewController] Updating pattern
2024-07-09 13:05:51 INFO [main] initialize module imreconstruct
INFO:imswitch:[main] initialize module imreconstruct
2024-07-09 13:05:51 INFO [main] initialize module imscripting
INFO:imswitch:[main] initialize module imscripting
2024-07-09 13:05:51 INFO [main] init done
INFO:imswitch:[main] init done

Hey, thanks for reporting the issue. Would you mind to share your config and the installation procedure of your ImSwitch version? Thanks!

I installed it through conda on a windows laptop. I didn’t use the installer. I am using the example_uc2 config

Thanks. Sorry I meant which channel. E.g. openuc2/imSwitch?

Which firmware are you using and also how did you install uc2-rest?

I installed it from the openuc2/imswitch repository. I used option C: installing from github. I pip installed UC2-REST.

I am using the uc2-esp firmware installed through platform.io on a wemos D1-R32 and CNC shield v3

1 Like

When I start up the GUI, it says my config file is “none”. Is this normal? From my understanding, the way to change the imswitch config file is by changing the setup file name in the imcontrol_options.json (line 2). Is there something additional I need to do? Its a little hard to follow on the imswitchconfig repository

Beginning Code:

(imswitch) C:\Users\ngavu>imswitch
2024-07-09 13:05:31 INFO [main] Starting ImSwitch 2.1.0
2024-07-09 13:05:31 INFO [main] Headless mode: 0
2024-07-09 13:05:31 INFO [main] Config file: None
2024-07-09 13:05:31 ERROR [main] QtWebEngineWidgets not found, disabling imnotebook
No module named ‘javabridge’

That’s alright. It’s a new “feature” to run imswitch fully headless inside a docker container. #workinprogress

It’s not entirely clear to me what fails and why.
Would you mind testing one of these configurations instead and see if the error persists?

The camera will surely be wrong, but it works on my computer with this version of openUC2/imswitch.

Also, you would need to change the setup config file name here: ImSwitchConfig/config/imcontrol_options.json at master · openUC2/ImSwitchConfig · GitHub

Okay, so to change to that configuration, I just need to add this json file to the imcontrol_setups folder and change the name in imcontrol_options file?

I changed the name of the config in the imcontrol_options file and still I received the same error. Not sure if this configuration you provided should be copied anywhere else besides the imcontrol_setups folder.

i get the error :[ESP32Manager → ESP32] Trying out port COM3 failed: could not open port ‘COM3’: PermissionError(13, ‘Access is denied.’, None, 5)

Common issues are that the port is being used by an additional serial monitor which i dont think is the case because I have nothing running on start up. I was able to confirm that the firmware was installed and connected through the online youseetoo controller you have.

Would this error always come up if you do not have the esp32 controller connected to the computer? I am wondering if its a hardware connection issue or a software issue. Would you have the same error if you started up imswitch on your end without the board connected?

@benedictdied I think I was able to fix this but i now ran into this error. Have you seen this before? Any solutions?

Here is the error code:

ERROR:imswitch:[main] Traceback (most recent call last):
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch_main_.py”, line 91, in main
view, controller = modulePkg.getMainViewAndController(
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol_init_.py”, line 56, in getMainViewAndController
view = ImConMainView(options, setupInfo)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\ImConMainView.py”, line 136, in init
self.widgets[‘Image’] = self.factory.createWidget(widgets.ImageWidget)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets\basewidgets.py”, line 29, in createWidget
widget = widgetClass(*args, **kwargs)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets\ImageWidget.py”, line 33, in init
self.addItem(self.crosshair)
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets\ImageWidget.py”, line 113, in addItem
item.attach(self.napariViewer,
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\view\guitools\naparitools.py”, line 788, in attach
canvas.connect(self.on_mouse_press)
AttributeError: ‘VispyCanvas’ object has no attribute ‘connect’

would you mind checking the napari version you have installed? Looks like a breaking change in some napari version.

@benedictdied

(imswitch) C:\Users\ngavu>napari --version
napari version 0.5.0

is the version i should have?

Nope, use the latest 0.4.x please. You should be able to do pip install napari==0.4.x where x is something 17 or something

Good catch though. I’ll look into that :slight_smile:

@benedictdied Okay, now I run into this error lol.

(imswitch) C:\Users\ngavu>imswitch
2024-07-12 12:04:20 INFO [main] Starting ImSwitch 2.1.0
2024-07-12 12:04:20 INFO [main] Headless mode: 0
2024-07-12 12:04:20 INFO [main] Config file: None
2024-07-12 12:04:24 ERROR [main] Failed to initialize module imcontrol
2024-07-12 12:04:24 ERROR [main] module ‘pydantic.main’ has no attribute ‘ModelMetaclass’
2024-07-12 12:04:24 ERROR [main] Traceback (most recent call last):
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch_main_.py”, line 91, in main
view, controller = modulePkg.getMainViewAndController(
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol_init_.py”, line 9, in getMainViewAndController
from .controller import ImConMainController
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller_init_.py”, line 1, in
from .ImConMainController import ImConMainController
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\controller\ImConMainController.py”, line 12, in
from imswitch.imcontrol.view import guitools
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view_init_.py”, line 1, in
from .ImConMainView import ImConMainView
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\ImConMainView.py”, line 9, in
from . import widgets
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets_init_.py”, line 1, in
from .AlignAverageWidget import AlignAverageWidget
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcontrol\view\widgets\AlignAverageWidget.py”, line 3, in
from imswitch.imcommon.view.guitools import naparitools, pyqtgraphtools
File “C:\Users\ngavu\Downloads\ImSwitch\imswitch\imcommon\view\guitools\naparitools.py”, line 5, in
from napari.utils.translations import trans
File “C:\Users\ngavu\miniconda3\envs\imswitch\lib\site-packages\napari\utils_init_.py”, line 2, in
from .colormaps import Colormap
File “C:\Users\ngavu\miniconda3\envs\imswitch\lib\site-packages\napari\utils\colormaps_init_.py”, line 2, in
from .colormap import Colormap
File “C:\Users\ngavu\miniconda3\envs\imswitch\lib\site-packages\napari\utils\colormaps\colormap.py”, line 9, in
from …events import EventedModel
File “C:\Users\ngavu\miniconda3\envs\imswitch\lib\site-packages\napari\utils\events_init_.py”, line 15, in
from .evented_model import EventedModel
File “C:\Users\ngavu\miniconda3\envs\imswitch\lib\site-packages\napari\utils\events\evented_model.py”, line 66, in
class EventedMetaclass(main.ModelMetaclass):
File “C:\Users\ngavu\miniconda3\envs\imswitch\lib\site-packages\pydantic_migration.py”, line 306, in wrapper
raise AttributeError(f’module {module!r} has no attribute {name!r}')
AttributeError: module ‘pydantic.main’ has no attribute ‘ModelMetaclass’

@benedictdied actually just fixed the above problem by using napari 0.4.19 but after doing that I ran into the same problem of “No controller found for widget positioner” again. Honestly not sure what to do here and if its a hardware problem or software problem.

It’s a python versioning problem.
How did you install imswitch? The latest documentation can be found here ImSwitch Installation on Mac and Windows

I know, QT is a pain. The NOQT branch is trying to get rid of it and uses the web instead.

the Pydantic issue is again a versioning problem. When you do pip install, there should be a list of non-compatible modules. It should complain about something.

ImSwitch/setup.cfg at master · openUC2/ImSwitch · GitHub seems to be not a fixed version. This has to be changed on my side. same with pydantic.

On my mac I use

 napari.__version__
'0.4.19'

pydantic.__version__
'1.10.16'

Can you please install them using e.g.

pip install napari==0.4.19 --force-reinstall
pip install pydantic==1.10.16 --force-reinstall

Thanks

@benedictdied
I installed it on my windows pc with the direction on this site ImSwitchInstallWindows | openUC2 Documentation

I used python 3.10 so maybe that why? I can reinstall the program with python 3.9 and see if that works but I remember switching to python 3.10 solved the jupyter notebook not being in the right place error.

I tried reinstalling both of those versions and still have the same error. Any other suggestions would be greatly appreciated!