Skip to content

Commit 70dcfe1

Browse files
Czakimelissawm
andauthored
Add troubleshooting about starting napari and LD_LIBRARY_PATH (#433)
# References and relevant issues # Description Add information about troubleshooting problems of non-empty `LD_LIBRARY_PATH` environment variable. --------- Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
1 parent a946c87 commit 70dcfe1

File tree

2 files changed

+65
-3
lines changed

2 files changed

+65
-3
lines changed

docs/tutorials/fundamentals/getting_started.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,63 @@ To learn more about:
172172
checkout the [viewer tutorial](viewer-tutorial)
173173
* how to use the napari viewer with different types of napari layers, see
174174
[layers at a glance](layers-glance)
175+
176+
177+
## Solving common problems
178+
179+
### napari does not launch with `No Qt bindings could be found`
180+
181+
If you try to start napari and see an error message containing following (or similar) text:
182+
183+
```
184+
ImportError: No Qt bindings could be found
185+
```
186+
187+
First you need to validate if you have Qt bindings installed. You can do this by running:
188+
189+
```bash
190+
pip list
191+
```
192+
193+
And check if `PyQt5`, `PySide2`, `PyQt6` or `PySide6` are mentioned in the output as installed.
194+
195+
If there is no such entry, please install one of them following the instructions
196+
in [Choosing a different Qt backend](choosing-qt-backend)
197+
198+
If some backend is installed but napari still does not start, please try to start it from command line:
199+
200+
```bash
201+
LD_LIBRARY_PATH="" napari
202+
```
203+
204+
If napari is successfully launched after this command, it means that on your machine
205+
the LD_LIBRARY_PATH environment variable is set to a directory that contains
206+
a Qt dynamic dependency that is incompatible with the one that napari uses.
207+
As linkers first search in LD_LIBRARY_PATH directories, this may cause napari to crash.
208+
209+
210+
If you want to debug this issue for your specific use case, you
211+
should start with manually importing the `qt` package in Python.
212+
This will provide you with more information about problem.
213+
214+
Such import may look like **one** of the following lines:
215+
216+
```python
217+
from PyQt5 import QtWidgets
218+
from PyQt6 import QtWidgets
219+
from PySide2 import QtWidgets
220+
from PySide6 import QtWidgets
221+
```
222+
223+
Such import may raise an error like:
224+
225+
```
226+
ImportError: .../site-packages/PyQt5/QtWidgets.abi3.so: undefined symbol: _ZdlPvm, version Qt_5
227+
````
228+
229+
Then when you identify which file is causing the problem you can use `ldd` command
230+
to check which libraries are used by this file:
231+
232+
```bash
233+
ldd .../site-packages/PyQt5/QtWidgets.abi3.so
234+
```

docs/tutorials/fundamentals/installation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ the current release {{ napari_version }}, using the command: `napari --version`
167167

168168
### Choosing a different Qt backend
169169

170+
(choosing-qt-backend)=
171+
170172
napari needs a library called [Qt](https://www.qt.io/) to run its user interface
171173
(UI). In Python, there are two alternative libraries to run this, called
172174
[PyQt5](https://www.riverbankcomputing.com/software/pyqt/download5) and
@@ -193,11 +195,11 @@ python -m pip install "napari[pyside2]" # for PySide2
193195
(note-m1)=
194196
```{note}
195197
196-
For arm64 macOS machines (Apple Silicon), pre-compiled PyQt5 or PySide2 packages
198+
For arm64 macOS machines (Apple Silicon), pre-compiled PySide2 packages
197199
([wheels](https://realpython.com/python-wheels/)) are not available on
198200
[PyPI](https://pypi.org), the repository used by `pip`, so trying to
199-
`pip install napari[all]` or either of the variants above will fail. However,
200-
you can install one of those libraries separately, for example from `conda-forge`,
201+
`pip install napari[pyside2]` or similar variant above will fail. However,
202+
you can install `pyside2` separately, for example from `conda-forge`,
201203
and then use `pip install napari`.
202204
```
203205

0 commit comments

Comments
 (0)