computational-cell-analytics / micro-sam

Segment Anything for Microscopy
https://computational-cell-analytics.github.io/micro-sam/
MIT License
311 stars 35 forks source link

Fix tests on macos-14 (currently the macos-latest github runner) #558

Closed constantinpape closed 1 month ago

constantinpape commented 2 months ago

The MAC tests fail due to some problem with running the GUI tests. This happens since a couple of days ago, maybe due to some update in the MAC runner?

See the corresponding error in the CI below.

Run aganders3/headless-gui@v2
running on darwin
/bin/bash -l -c pytest
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/_pytest/main.py", line 281, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1130, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pluggy/_hooks.py", line 535, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pytestqt/plugin.py", line 243, in pytest_configure
INTERNALERROR>     qt_api.set_qt_api(config.getini("qt_api"))
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pytestqt/qt_compat.py", line 85, in set_qt_api
INTERNALERROR>     or self._guess_qt_api()
INTERNALERROR>        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pytestqt/qt_compat.py", line 76, in _guess_qt_api
INTERNALERROR>     if _can_import(f"{backend}.QtCore"):
INTERNALERROR>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pytestqt/qt_compat.py", line 67, in _can_import
INTERNALERROR>     _import(name)
INTERNALERROR>   File "/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/pytestqt/qt_compat.py", line 29, in _import
INTERNALERROR>     return __import__(name)
INTERNALERROR>            ^^^^^^^^^^^^^^^^
INTERNALERROR> ImportError: dlopen(/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/PyQt5/QtCore.abi3.so, 0x0002): Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore
INTERNALERROR>   Referenced from: <5DB832BD-87BC-3750-B686-5A0A711D09B3> /Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/PyQt5/QtCore.abi3.so
INTERNALERROR>   Reason: tried: '/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore' (no such file), '/Users/runner/micromamba/envs/sam/lib/python3.11/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore' (no such file), '/Users/runner/micromamba/envs/sam/bin/../lib/QtCore.framework/Versions/5/QtCore' (no such file), '/Users/runner/micromamba/envs/sam/bin/../lib/QtCore.framework/Versions/5/QtCore' (no such file)
Error: The process '/bin/bash' failed with exit code 3
The process '/bin/bash' failed with exit code 3

Any idea how this could be fixed @GenevieveBuckley ?

GenevieveBuckley commented 1 month ago

I have a fix here https://github.com/computational-cell-analytics/micro-sam/pull/595 - it seems pip was uninstalling the working version of pyqt we already had and reinstalling a different version that does not work well on M1 Mac machines.