autokey / autokey

AutoKey, a desktop automation utility for Linux and X11.

Home Page:https://autokey.github.io/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autokey 0.96.0 fails with ModuleNotFoundError: No module named '_dbus_bindings'

simoxyl opened this issue · comments

AutoKey is a Xorg application and will not function in a Wayland session. Do you use Xorg (X11) or Wayland?

Xorg

Has this issue already been reported?

  • I have searched through the existing issues.

Is this a question rather than an issue?

  • This is not a question.

What type of issue is this?

Bug

Choose one or more terms that describe this issue:

  • autokey triggers
  • autokey-gtk
  • autokey-qt
  • beta
  • bug
  • critical
  • development
  • documentation
  • enhancement
  • installation/configuration
  • phrase expansion
  • scripting
  • technical debt
  • user interface

Other terms that describe this issue if not provided above:

No response

Which Linux distribution did you use?

Ubuntu 18.04.6 LTS

Which AutoKey GUI did you use?

Qt

Which AutoKey version did you use?

0.96.0

How did you install AutoKey?

sudo apt-get install libdbus-1-dev libdbus-glib-1-dev
sudo -H pip3 install autokey

Can you briefly describe the issue?

I get this error when I run autokey

/usr/bin/autokey-run --verbose
Traceback (most recent call last):
File "/usr/bin/autokey-run", line 23, in
import dbus
File "/usr/lib/python3/dist-packages/dbus/init.py", line 77, in
import dbus.types as types
File "/usr/lib/python3/dist-packages/dbus/types.py", line 6, in
from _dbus_bindings import (
ModuleNotFoundError: No module named '_dbus_bindings'

Can the issue be reproduced?

I didn't try

What are the steps to reproduce the issue?

No response

What should have happened?

No response

What actually happened?

No response

Do you have screenshots?

No response

Can you provide the output of the AutoKey command?

No response

Anything else?

No response

commented

Welcome to the AutoKey community, @simoxyl !

Let's unpack this.

  • It's likely that you just want run AutoKey as a service/application. If that's the case, then you should be running autokey or one of our front ends (autokey-qt or autokey-gtk - whichever you prefer). (Just specifying autokey will launch one of the front ends for you.)

autokey-run is a special purpose program so that (once AutoKey is already running in the background) you can run selected AutoKey scripts from an external program such as a bash script.

  • We provide deb packages for AutoKey. When you install using them, all the necessary dependencies should be installed for you.

  • As to your specific error, I'm not sure, but I have been running AutoKey (currently 0.96.0) on kubuntu 18.04 for years with no install issues.

Please provide more details if the above don't solve your issue...

When you get a chance, check out our wiki. It has lots of helpful articles and example scripts.

We also have a number of places to talk about AutoKey and to ask for support.

Hi @josephj11, I managed to solve the _dbus_bindings issue with setting sym links as described in https://askubuntu.com/questions/1141743/no-module-named-dbus-bindings

Note: I followed the steps described in Autokey installation page (https://github.com/autokey/autokey/wiki/Installing)

The next failure is 'from PyQt5 import Qsci' looking for GLIBC_2.32. Do yo have any inputs here? Call stack below:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/autokey/qtui/scriptpage.py", line 20, in
from PyQt5 import Qsci
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found

Note: I followed the steps described in Autokey installation page (https://github.com/autokey/autokey/wiki/Installing)

That page needs to be updated. I'm sorry for the confusion it's causing. I'm not sure I'm up to the job of updating it, but perhaps if we all put our heads together, we can figure out what needs to be changed, removed, or added to get the information on it to be solid.

Meanwhile, I noticed that you use Ubuntu 18.04.6 LTS. I believe that offers AutoKey 0.95.10 in the Ubuntu repositories. Regardless of which version it provides, I recommend installing AutoKey that way and then uninstalling it. Then, when you install AutoKey 0.96.0, it should have everything it needs. At least, that worked for me in a virtual machine that has Kubuntu 22.04 LTS installed on it.

Just in case that still leaves you without everything you need, these are the apt requirements for AutoKey 0.96.0 and these are the pip requirements.

commented

I opened muon and looked for glibc. I have 2.27-3, not 2.32.

Qsci is the mini code editor we use for editing scripts in the script panel in the AutoKey GUI.

As we have both mentioned, it's a lot easier if you do a clean install with a deb package. Then, if you really want to start over and use pip or even a git clone, all the dependencies should be there.

There's no advantage to installing from pip that I can think of. Our debs are as new as anything we have in pip and if we rebuild the master, a few small newer changes will be in the new debs as well. The only things newer than that are in our master and develop branches which you would have to git clone... And you definitely don't want to go to that level until a simple package install works fine on your system.

We just went through some growing pains when some versions of Python and supporting pieces were updated and broke our CI and testing flows. Unless you're a serious AutoKey/Python developer (which we would love!), there's no reason for you to have to deal with things like that.

I just saw some comments on Reddit to the effect that Ubuntu, starting with 23.04, is doing something about blocking pip for general installs of anything and encouraging users to use venvs - Python virtual environments instead. I have no idea what that's all about other than "pip bad".

The Ubuntu developers probably are planning on doing that since pip is a repository that's not under their management. It makes sense that they might wish to discourage the use of outside repositories.

commented

@Elliria I don't think that's it. It's more that significant parts of Debian/Ubuntu are written in Python and since it's not totally compiled (if at all), allowing users to install various Python modules that may be different versions that are incompatible with this infrastructure could really break things in very diverse and hard to diagnose ways.

That makes sense.

@josephj11 and @Elliria I purged and did a clean install with deb packages. I still run into GLIB_2.32 issue.

on my comp, ldd --version outputs "ldd (Ubuntu GLIBC 2.27-3ubuntu1.6) 2.27"

I really want to use Autokey and just can't get it to work :/

Do you have all of the packages listed on this page installed on your system?

all of them are installed by executing:
$ sudo apt install dbus python3-dbus libdbus-1-dev libpython3-dev libdbus-glib-1-dev libgirepository1.0-dev wmctrl gir1.2-gtk-3.0 gir1.2-gtksource-3.0 gir1.2-appindicator3-0.1 gir1.2-glib-2.0 gir1.2-notify-0.7 python3-gi zenity kdialog pyqt5-dev-tools x11-xserver-utils

Executing autokey outputs:

...
File "<string>", line 67, in <module>
File "/usr/lib/python3/dist-packages/autokey/qtui/scriptpage.py", line 20, in <module>
     from PyQt5 import Qsci
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/local/home/bv/.local/lib/python3.8/site-packages/PyQt5/Qsci.abi3.so)

Does it have to do with dependency of latest version of qscintilla on GLIBC 2.32?
python-qscintilla2 is already the newest version (2.10.2+dfsg-4)

I don't think we have the AutoKey requirements fully figured out yet.

Your error says that GLIBC is required by PyQt5, which is one of the requirements in the pip-requirements.txt file. Do you have all of those libraries on your system?

If you do, that's a new puzzle. If you don't, please be careful about installing stuff when attempting to debug this.

I saw that error and more yesterday when I was trying to learn how to use an AutoKey clone inside of a virtual environment. Even though I had already installed everything in the apt-requirements.txt file and everything in the pip-requirements.txt file, I still had a procession of missing files, with a new one popping up every time I satisfied one. I started installing stuff like crazy in response and ended up making a solid mess of my VM without ever figuring it all out and it will be easier to create a new VM than to try to remove everything (and its dependencies) that got installed.

We could use some help from someone who knows why this is happening and what to do about it.

commented

@Elliria While it still is probably easier to start from scratch after such an excursion into dependency hell, it's not quite as bad as it looks.

I don't know about other package management systems, but apt distinguishes between packages that were installed by commands and those that were only installed to satisfy dependencies. It marks the former "manual" and the latter "automatic". When a manual package is subsequently uninstalled, its automatic dependencies become orphans unless other packages also depend on them.

Running sudo apt autoremove will remove all of these orphans for you. This is good way to get rid of old kernels after upgrades (the current and previous one are not removed by default).

A (usually undesirable) side effect of this is that if you happen to manually install a package that is already installed on your system as automatic, it gets changed to manual. This can be a problem, especially when trying to recreate the package environment from an old Linux install in a new install. I wrote a bash installer script that prevents this from happening.

If you do run into this, the apt-mark command can be used to adjust/repair such settings.

I would be very interested in that script. As part of this, I was going to run the xargs sudo apt-get install <apt-requirements.txt command to install any missing apt requirements for AutoKey, but decided against it. The set to manually installed messages for the packages in the list were creepy, so I said no when it asked if I wanted to go for it.

I did a few searches to figure out how to install only missing packages, but Google seemed to misunderstand me, so it's still not solved. There should be a simple, non-intrusive way to ask Bash to use a list to figure out what you don't have and only install that while ignoring the rest.

Anyway, I didn't pay enough attention to all the things I installed that day and all the ways it was done (it was a mess of apt and pip commands), so it's currently a mess and untangling it would be more time-consuming than just replacing the thing.

commented

@Elliria Here it is.

It might work for you as is because it defaults to installing. It was designed to read the output of dpkg -l, but a simple file of just package names should work fine.

The actual install command is prefixed with an echo command, so it effectively does a dry run. Remove the echo from it when you want a live run.

I have very limited dropbox space, so the link will probably die after a few months.

Thanks. It's perfect. It looks like I was missing two files:

WhatTheScriptWouldDo

Granted, that's in my currently severely-messed-up VM, but I'll be running it in the new one as well.

commented

It's always nice when something gets reused.

I'm going to use it to the extreme. It's going to be a permanent part of my development tool collection. Love it.

@simoxyl, you might want to try running @josephj11's script and, if it finds anything to install, then remove the echo from the echo sudo apt-get install "$1" line so that it installs them for you.

commented

Also, since 18.04 is end of life now, you might want to install/activate Ubuntu Advantage. It's free for individuals and will continue to update some packages for you. I'm using it now.

Upgrading is a really good idea. If you check the Ubuntu Releases page, Ubuntu 18.04 LTS will reach EOSS (end of standard support) in June of 2023, but won't reach EOL (end of life) until April of 2028. As @josephj11 said, you can continue to receive some updates with Ubuntu Pro (the new name for Ubuntu Advantage) for free during EOSS.

But...

The way it works is that you'll receive updates to all packages except for packages in the Universe repository. Depending on which (and how many) packages you use from the Universe repository, you'll want to strongly consider upgrading. The Python script on this StackExchange page worked well to quickly tell me how many of those packages I use and lists all of their names.

Ok, this is what the dry run shows:

bash install_batch apt-requirements.txt
Package [dbus] Action []
Skipping [dbus] - already installed
Package [python3-dbus] Action []
Skipping [python3-dbus] - already installed
Package [libdbus-1-dev] Action []
Skipping [libdbus-1-dev] - already installed
Package [libpython3-dev] Action []
Skipping [libpython3-dev] - already installed
Package [libdbus-glib-1-dev] Action []
Skipping [libdbus-glib-1-dev] - already installed
Package [libgirepository1.0-dev] Action []
Skipping [libgirepository1.0-dev] - already installed
Package [wmctrl] Action []
Skipping [wmctrl] - already installed
Package [gir1.2-gtk-3.0] Action []
Skipping [gir1.2-gtk-3.0] - already installed
Package [gir1.2-gtksource-3.0] Action []
Skipping [gir1.2-gtksource-3.0] - already installed
Package [gir1.2-appindicator3-0.1] Action []
Skipping [gir1.2-appindicator3-0.1] - already installed
Package [gir1.2-glib-2.0] Action []
Skipping [gir1.2-glib-2.0] - already installed
Package [gir1.2-notify-0.7] Action []
Skipping [gir1.2-notify-0.7] - already installed
Package [python3-gi] Action []
Skipping [python3-gi] - already installed
Package [zenity] Action []
Skipping [zenity] - already installed
Package [kdialog] Action []
Skipping [kdialog] - already installed
Package [pyqt5-dev-tools] Action []
Skipping [pyqt5-dev-tools] - already installed

All of them are installed. Problem with not finding correct GLIBC version (because of QScintilla) still exists.

Do you have all of the libraries in the pip-requirements.txt file installed, @simoxyl? You can get them by running this command when you're in the same directory as the pip-requirements.txt file, which is in AutoKey's main directory:

pip3 install -r pip-requirements.txt

Also, I noticed that you used the sudo -H pip3 install autokey command to install AutoKey.
The -H command-line switch makes sudo use root 's home directory instead of your user's home directory. I'm not sure if that would cause any issues.

The pip instructions on the Installing wiki page are outdated and should show the pip3 install autokey command. What happens if you install AutoKey that way?

Lower down on that page are some instructions suggesting that you can install the PyPi dependencies for either of the user interfaces with either the pip3 install --user ./autokey'[GTK]' or the pip3 install --user ./autokey'[QT]' command. Those might be worth a try.

I haven't done a pip installation of AutoKey (or, if I have, it was quite some time ago and I totally forget it) and there may be things we need to iron out about the installation instructions.

Another way to get all the dependencies is to install AutoKey from your distribution's repositories first and then uninstall it.