connectomicslab/connectomemapper3

BUG: Running `cmpbidsappmanager` just hangs, no GUI appearing

jsheunis opened this issue ยท 8 comments

Issue related to JOSS review: openjournals/joss-reviews#4248

When running cmpbidsappmanager, the following appears in the terminal:

>> cmpbidsappmanager

Connectome Mapper v3.0.3 - BIDS App Manager
------------------------------------------------------
Copyright (C) 2009-2022, Ecole Polytechnique Federale de Lausanne (EPFL) the University Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland, and Contributors, All rights reserved.
------------------------------------------------------
------------------------------------------------------
  .. INFO: Use qt for graphical backend
------------------------------------------------------

_

then an icon appears in my Mac's doc bar:

Screenshot 2022-04-15 at 12 25 38

and after that nothing happens. Have tried multiple times, no difference. I'm expecting the GUI to appear, is that what should happen? Should I do something about the note regarding qt?

Hi @jsheunis,

Sorry to hear you are still having issues with the GUI...

This is indeed not the expected behaviour and a window should appear at this point.

I tried to reproduce it on my macbookpro (MacOS Catalina 10.15.7 / conda 4.11.0) (I completely uninstalled connectomemapper3 and the environment and I reinstalled it following the instructions in the docs and the workaround in #160 ), but it appears cmpbidsappmanager starts without any problem on my machine.

Possible source of problem
This made me suspecting that it might be related to Qt-based GUI on Big Sur and after searching on internet, I discovered that several Qt-based applications had a similar issue when using PyQt/PySide2 >= 5.13.2 and < 5.15.2:

In our case, PyQt/PySide2 5.13.2 is indeed installed in our py37cmp-gui environment:

In this sense, the closest issue would correspond to the last enumerated one (https://tickets.metabrainz.org/browse/PICARD-1858) that was fixed here: metabrainz/picard#1633 (comment). Briefly, it consisted in downgrading PyQt from 5.13.2 to 5.13.1.

Possible solution
Please could you try to modify the environment_macosx.yml by changing the line - pyside2=5.13.2 to - pyside2=5.13.1 and reinstall the environment as follows?

conda deactivate # make sure the py37cmp-gui environment is not activated
conda env remove -n py37cmp-gui
conda env create -f /path/to/edited/environment_macosx.yml

As regards

Should I do something about the note regarding qt?

I would say here no.

The tool used for graphical backend of the TraitsUI elements, which is selected by setting the environment variables ETS_TOOLKIT and QT_API:

os.environ["ETS_TOOLKIT"] = "qt" # pylint: disable=E402 # noqa
# os.environ['QT_API'] = 'pyqt5'
os.environ["QT_API"] = "pyside2" # pylint: disable=E402 # noqa

and the message INFO: Use qt for graphical backend is just used to confirm that ETS_TOOLKIT has been set to qt:

print(" .. INFO: Use {} for graphical backend".format(ETSConfig.toolkit))

Let me know if this works or if you have any further questions.

Best

I did as you suggested, but still had the same issue.

After removing the existing conda environment, and installing a new one from the edited environment_macosx.yml file, I ran pip list. This included the following:

PyQt5                         5.12.3
PyQt5_sip                     4.19.18
PyQtChart                     5.12
PyQtWebEngine                 5.12.1

I'm not deeply familiar with the connection between pyside2 and PyQt, but I'm guessing after setting pyside2=5.12.1 in the environment file, we'd want PyQt5 to have the same version number? If so, this doesn't seem to be happening during the conda environment creation.

I tried uninstalling PyQt5 and reinstalling it with the specific version:

pip uninstall PyQt5
pip install PyQt5==5.12.1
pip list
>>
PyQt5                         5.12.1
PyQt5_sip                     4.19.18
PyQtChart                     5.12
PyQtWebEngine                 5.12.1

which executed successfully, but the initial issue still remained. Any other ideas?

If this persists, I'm not sure that this issue should necessarily hold up the JOSS review if it's just an edge case.

That's what I would have also done...

Another idea could be to update PyQt5 to the latest version (as it seems it was fixed in version >= 5.15.2), and choose pyqt5 as backend directly.

  1. To reinstall the latest version of PyQt5:
$ pip uninstall PyQt5
$ pip install PyQt5==5.15.6
  1. To choos PyQt5 directly, you would need to uncomment line 15 and comment line 16 in the file cmpbidsappmanager.py:

    os.environ["ETS_TOOLKIT"] = "qt" # pylint: disable=E402 # noqa
    # os.environ['QT_API'] = 'pyqt5'
    os.environ["QT_API"] = "pyside2" # pylint: disable=E402 # noqa

    that should be found in the .../miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/cli folder. This will tell traitsui to use directly PyQt5 as backend.

Hope this will work ๐Ÿคž

Hi @sebastientourbier - thanks for this. This change to pyqt5 now causes a BIDS App Manager to pop up ....but it is completely blank.

This is the error message, please can you help further?:

(py37cmp-gui) rorypiper@eduroam-int-dhcp-97-64-214 software % cmpbidsappmanager
objc[55865]: Class QMacAutoReleasePoolTracker is implemented in both /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/python3.7/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x177bee198) and /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/libQt5Core.5.12.9.dylib (0x189671528). One of the two will be used. Which one is undefined.
objc[55865]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/python3.7/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x177bee210) and /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/libQt5Core.5.12.9.dylib (0x1896715a0). One of the two will be used. Which one is undefined.
objc[55865]: Class KeyValueObserver is implemented in both /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/python3.7/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x177bee238) and /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/libQt5Core.5.12.9.dylib (0x1896715c8). One of the two will be used. Which one is undefined.
objc[55865]: Class RunLoopModeTracker is implemented in both /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/python3.7/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x177bee288) and /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/libQt5Core.5.12.9.dylib (0x189671618). One of the two will be used. Which one is undefined.
objc[55865]: Class QCocoaPageLayoutDelegate is implemented in both /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/python3.7/site-packages/PyQt5/Qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x177e01540) and /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/libQt5PrintSupport.5.12.9.dylib (0x18b9593b0). One of the two will be used. Which one is undefined.
objc[55865]: Class QCocoaPrintPanelDelegate is implemented in both /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/python3.7/site-packages/PyQt5/Qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x177e015b8) and /Users/rorypiper/opt/anaconda3/envs/py37cmp-gui/lib/libQt5PrintSupport.5.12.9.dylib (0x18b959428). One of the two will be used. Which one is undefined.

Connectome Mapper v3.0.3 - BIDS App Manager

Copyright (C) 2009-2022, Ecole Polytechnique Federale de Lausanne (EPFL) the University Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland, and Contributors, All rights reserved.


.. INFO: Use qt for graphical backend

Scratch that. You have solved this already - here: #61

:)

Your fix on May 9th worked BTW! Thanks!

@jsheunis, did you have the chance to give a try on this:

That's what I would have also done...

Another idea could be to update PyQt5 to the latest version (as it seems it was fixed in version >= 5.15.2), and choose pyqt5 as backend directly.

1. To reinstall the latest version of PyQt5:
$ pip uninstall PyQt5
$ pip install PyQt5==5.15.6
2. To choos PyQt5 directly, you would need to uncomment line 15 and comment line 16 in the file `cmpbidsappmanager.py`:

os.environ["ETS_TOOLKIT"] = "qt" # pylint: disable=E402 # noqa
# os.environ['QT_API'] = 'pyqt5'
os.environ["QT_API"] = "pyside2" # pylint: disable=E402 # noqa

   that should be found in the `.../miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/cli` folder. This will tell `traitsui` to use directly PyQt5 as backend.

Hope this will work ๐Ÿคž

?

If this solution works, I could plan to integrate it directly in the upcoming release.

This solved the issue, thanks!

Great! You're welcome!