Reputation: 4426
I have installed a pip package, but trying to use it I get errors about some modules or classes not being available. How can I investigate the root cause myself?
On OpenSuse Leap 15.1, no binary package for AutoKey is available. As a consequence I was trying to install it with
pip install --user autokey # --user because I'm not root at work.
After executing this, when I try to run the GUIs, I get import-related exceptions:
autokey-gtk
: ValueError: Namespace AppIndicator3 not available
, raised by gi.require_version(...)
. [1]qutokey-qt
: ImportError: cannot import name 'Qsci'
, raised by an from ... import Qsci
line.While trying to figure out how to resolve the error, likely related to missing dependencies, I started to wonder: Is there any way to figure out what is missing from the error message? Running pip3 search Qsci
and pip3 search AppIndicator3
would seem an obvious solution, but don't yield any results.
I intentionally omit the full backtrace for now in order to avoid distracting from the core question: How can I try to find the solution myself?
Upvotes: 1
Views: 455
Reputation: 7035
I recognize this error as specific to the way PyGObject handles dependencies. You should see a line similar to the following in the stack trace:
File "/path/to/blah/indicator.py", line 31, in <module>
gi.require_version('AppIndicator3', '0.1')
Once you install the appropriate GLib/Gtk feature, PyGObject will be able to find it via GObject introspection, and automatically bind to it, so there's no Python-specific package that needs to be installed to access the app indicator feature.
On my Ubuntu 18.04 system, installing these packages was enough:
$ sudo apt install gir1.2-appindicator3-0.1 libappindicator3-0.1-cil
Here are details about the two packages:
I'm not convinced that the second one was necessary.
Upvotes: 1
Reputation: 3374
Documentation of package you've installed should have instructions about any external dependencies on various platforms.
Second option is to use pip_missing_reqs.
Upvotes: 1