error "RuntimeError: No pyface.toolkits plugin could be loaded for qt" when calling GUI

196 views
Skip to first unread message

FarNaf

unread,
Jul 22, 2021, 1:24:57 PM7/22/21
to cmtk-users
Greetings!

I have recently trying installing connectome mapper on docker for windows. Going over the steps mentioned in https://connectome-mapper-3.readthedocs.io/en/latest/installation.html step-by-step, I encountered the following error when installing the environment (conda env create -f environment.yml):
PackagesNotFoundError: The following packages are not available from current channels:
 -graphviz=2.40.1 

Then, found out this version of graphviz doesn't exist! so chaged the environment.yml to include graphviz=2.38, which is an available version on the internet. Next two steps of installation were successful, until calling the GUI:
cmpbidsappmanager
which resulted in the following error:
raise RuntimeError(msg)
RuntimeError: No pyface.toolkits plugin could be loaded for qt

I have no idea how to resolve this issue. Any help would be much appreciated. 

Thanks

Pascal Deschwanden

unread,
Aug 11, 2021, 11:56:06 AM8/11/21
to cmtk-users
Dear FarNaf

I got exactly the same error-message today. I'm also working on a windows computer and hoped to find an answer here, but seems like there is no solution to this problem yet? Or have you come up with an idea to solve the problem?

Best wishes,
Pascal

Sebastien Tourbier

unread,
Aug 16, 2021, 5:19:36 AM8/16/21
to cmtk-users
Dear FarNaf and Pascal,

Thanks a lot for your feedback on using CMP3 on Windows!
It seems as for MacOSX, some packages available on Conda for Linux are not available on a Windows  platform...
This suggests a windows-specific `environment_win.yml` could be very valuable.
However, I have only access to Linux and MacOSX machines on my side, mitigating this investigation of this on my side...

But based on the error, there might a problem at the configuration of the graphical backend (CMP3 is using Qt5 from Pyside2) at the beginning of the `cmpbidsappmanager` script. Indeed, multiple environment variables are set there (see https://github.com/connectomicslab/connectomemapper3/blob/249e4e5468b62362725ab8e6620483d45eb1aa4e/cmp/cli/cmpbidsappmanager.py#L8-L15) and this might not work properly when executed on Windows.

So I would have the following questions:

* When you do:
  >> conda activate py37cmp-gui
  >> conda list
  Do you have Pyside2 installed (i.e. appearing in the list)?

* To know if the environment variables are well set, please could you change the beginning of the `cmpbidsappmanager.py` script on your side and reinstall CMP3. This would consist of the following:

    1. Add `print(f'os.environ: {os.environ}')` line 16 right after `os.environ['QT_API'] = 'pyside2'`
    2. Reinstall CMP3:
        >> cd connectomemapper3/  # Got the directory of the cloned repository
        >> pip install .
    3. Execute cmpbidsappmanager:
        >> cmpbidsappmanager

Best,
Seb

Pascal Deschwanden

unread,
Aug 16, 2021, 10:40:50 AM8/16/21
to cmtk-users
Dear Seb

Thank you very much for the reply! I've just tried what you asked me to do:

1) Yes, Psyside 2 was listed/installed
2) After I added the code, installed CM3 againg and applied the  cmpbidsappmanager-code, I got the following messages:

Traceback (most recent call last):
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\pdesc\miniconda3\envs\py37cmp-gui\Scripts\cmpbidsappmanager.exe\__main__.py", line 4, in <module>
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\cmp\cli\cmpbidsappmanager.py", line 20, in <module>
    from cmp.bidsappmanager import gui
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\cmp\bidsappmanager\gui.py", line 21, in <module>
    from pyface.api import ImageResource
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\pyface\api.py", line 12, in <module>
    from .about_dialog import AboutDialog
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\pyface\about_dialog.py", line 15, in <module>
    from .toolkit import toolkit_object
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\pyface\toolkit.py", line 23, in <module>
    toolkit = toolkit_object = find_toolkit("pyface.toolkits")
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\pyface\base_toolkit.py", line 269, in find_toolkit
    return import_toolkit(ETSConfig.toolkit, entry_point)
  File "c:\users\pdesc\miniconda3\envs\py37cmp-gui\lib\site-packages\pyface\base_toolkit.py", line 233, in import_toolkit
    raise RuntimeError(msg)
RuntimeError: No pyface.toolkits plugin could be loaded for qt

Does this mean anything to you? 

Thanks a lot and best wishes,

Pascal

Sebastien Tourbier

unread,
Aug 17, 2021, 1:34:01 PM8/17/21
to cmtk-users
Dear FarNaf and Pascal,

I have good news! I managed to get access to a windows machine today and to find a fix for you. The pyface/qt related error seems to be raised when we use a pyside2 graphical backend, while it works when we use a pyqt5 backend. I open the issue https://github.com/connectomicslab/connectomemapper3/issues/101#issue-972894734 directly on github where I put the full solution. In mainly consist of a new conda environment specific for windows (where I removed git-annex, corrected the version of graphviz, and updated traitsui to 7.0.0 now required by traitsui/pyqt5 backend)

Let me know if that works or if I can clarify some steps. Just comment in the github issue.

Best,
Seb
Reply all
Reply to author
Forward
0 new messages