neuroinformatics-unit / movement

Python tools for analysing body movements across space and time
http://movement.neuroinformatics.dev
BSD 3-Clause "New" or "Revised" License
77 stars 7 forks source link

napari fails to launch on Ubuntu 24.04 LTS #226

Closed niksirbi closed 1 week ago

niksirbi commented 1 week ago

Describe the bug I stumbled upon this while working on #218 on my ThinkPad T470s, freshly updated to Ubuntu 24.04 LTS x86_64. I had troubles with launching the in-development movement plugin for napari, but then I realised the problem was on the napari side.

This is not a movement bug right now, as we haven't yet released a napari plugin, but if not solved it will become our problem too.

To Reproduce Following napari's installation instructions to the letter:

conda create -y -n napari-env -c conda-forge python=3.10
conda activate napari-env
pip install napari[all]

The above commands complete succesfully, but when launching napari from the terminal, it fails with: ImportError: No Qt bindings could be found.

Full Traceback
Traceback (most recent call last):
  File "/home/niko/.miniforge3/envs/napari-env/lib/python3.10/site-packages/napari/_qt/__init__.py", line 8, in 
    from qtpy import API_NAME, QtCore
  File "/home/niko/.miniforge3/envs/napari-env/lib/python3.10/site-packages/qtpy/__init__.py", line 287, in 
    raise QtBindingsNotFoundError from None
qtpy.QtBindingsNotFoundError: No Qt bindings could be found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/niko/.miniforge3/envs/napari-env/bin/napari", line 8, in 
    sys.exit(main())
  File "/home/niko/.miniforge3/envs/napari-env/lib/python3.10/site-packages/napari/__main__.py", line 560, in main
    _maybe_rerun_with_macos_fixes()
  File "/home/niko/.miniforge3/envs/napari-env/lib/python3.10/site-packages/napari/__main__.py", line 438, in _maybe_rerun_with_macos_fixes
    from napari._qt import API_NAME
  File "/home/niko/.miniforge3/envs/napari-env/lib/python3.10/site-packages/napari/_qt/__init__.py", line 18, in 
    raise ImportError(
ImportError: No Qt bindings could be found.

napari requires either PyQt5 (default) or PySide2 to be installed in the environment.

With pip, you can install either with:
  $ pip install -U 'napari[all]'  # default choice
  $ pip install -U 'napari[pyqt5]'
  $ pip install -U 'napari[pyside2]'

With conda, you need to do:
  $ conda install -c conda-forge pyqt
  $ conda install -c conda-forge pyside2

Our heuristics suggest you are using 'pip' to manage your packages.

Expected behaviour The napari window should have launched.

Log file n/a

Screenshots n/a

Computer used (please complete the following information):

Additional context

niksirbi commented 1 week ago

Napari developers kindly helped with diagnosing this issue, see the zulipchat topic.

In the end it came down to dynamically linked libraries in my $LD_LIBRARY_PATH. napari actually launches fine if I temporarily wipe that viariable with $ LD_LIBRARY_PATH="" napari.

Will close this for now, and I may re-open it if others encounter it too (though it's mostly a napari + qtpy issue, not for us to fix).