Closed advance512 closed 11 months ago
Hi @advance512. It's probably better to install dependencies like that:
pip3 install -r requirements.txt
You would still need to install the libevdev
library itself through the system package manager, but I think otherwise this should work.
Hi @advance512. It's probably better to install dependencies like that:
pip3 install -r requirements.txt
You would still need to install the
libevdev
library itself through the system package manager, but I think otherwise this should work.
I did install it. Great:
$ sudo apt-get install python3-libevdev
[sudo] password for alon:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
bridge-utils ubuntu-fan
Use 'sudo apt autoremove' to remove them.
Suggested packages:
python-libevdev-doc
The following NEW packages will be installed:
python3-libevdev
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 17.5 kB of archives.
After this operation, 98.3 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu lunar/universe amd64 python3-libevdev all 0.5-3 [17.5 kB]
Fetched 17.5 kB in 1s (19.1 kB/s)
Selecting previously unselected package python3-libevdev.
(Reading database ... 243682 files and directories currently installed.)
Preparing to unpack .../python3-libevdev_0.5-3_all.deb ...
Unpacking python3-libevdev (0.5-3) ...
Setting up python3-libevdev (0.5-3) ...
$
but:
$ sudo apt-get install python3-inquirer
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-inquirer
So you cannot run it outside the virtualenv.
I also tried with a virtualenv:
$ pip install -r requirements.txt
Collecting libevdev~=0.11
Downloading libevdev-0.11.tar.gz (27 kB)
Preparing metadata (setup.py) ... done
Collecting inquirer~=3.1.3
Downloading inquirer-3.1.3-py3-none-any.whl (18 kB)
Collecting blessed>=1.19.0
Downloading blessed-1.20.0-py2.py3-none-any.whl (58 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.4/58.4 kB 1.1 MB/s eta 0:00:00
Collecting python-editor>=1.0.4
Using cached python_editor-1.0.4-py3-none-any.whl (4.9 kB)
Collecting readchar>=3.0.6
Downloading readchar-4.0.5-py3-none-any.whl (8.5 kB)
Collecting wcwidth>=0.1.4
Downloading wcwidth-0.2.8-py2.py3-none-any.whl (31 kB)
Collecting six>=1.9.0
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: setuptools>=41.0 in ./.venv/lib/python3.11/site-packages (from readchar>=3.0.6->inquirer~=3.1.3->-r requirements.txt (line 2)) (66.1.1)
Building wheels for collected packages: libevdev
Building wheel for libevdev (setup.py) ... done
Created wheel for libevdev: filename=libevdev-0.11-py3-none-any.whl size=23837 sha256=b93529f43ed5fe8a18a33ef27d7a4c514ea4e2aa8d8ab8938e03db04b1e31cb2
Stored in directory: /home/alon/.cache/pip/wheels/4e/29/79/d73742baf28a266ad21cd7808be07cf4925aee11eda949b943
Successfully built libevdev
Installing collected packages: wcwidth, python-editor, six, readchar, libevdev, blessed, inquirer
Successfully installed blessed-1.20.0 inquirer-3.1.3 libevdev-0.11 python-editor-1.0.4 readchar-4.0.5 six-1.16.0 wcwidth-0.2.8
$
and ran it with @veenoise 's PR, which was required, and got:
(.venv) $ python3 -m src
[?] Select a device: usb-Das_Keyboard_Das_Keyboard_P13-event-kbd
> usb-Das_Keyboard_Das_Keyboard_P13-event-kbd
usb-Das_Keyboard_Das_Keyboard_P13-if01-event-kbd
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/alon/workspace/scratch/KeyboardChatteringFix-Linux/src/__main__.py", line 49, in <module>
with get_device_handle(args.keyboard or retrieve_keyboard_name()) as device:
File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/home/alon/workspace/scratch/KeyboardChatteringFix-Linux/src/__main__.py", line 16, in get_device_handle
fd = open(abs_keyboard_path(keyboard_name), 'rb')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/dev/input/by-id/usb-Das_Keyboard_Das_Keyboard_P13-event-kbd'
Of course, it is not being run with super user permissions.
So trying to sudo
it:
(.venv) $ sudo python3 -m src
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/alon/workspace/scratch/KeyboardChatteringFix-Linux/src/__main__.py", line 9, in <module>
from src.keyboard_retrieval import retrieve_keyboard_name, INPUT_DEVICES_PATH, abs_keyboard_path
File "/home/alon/workspace/scratch/KeyboardChatteringFix-Linux/src/keyboard_retrieval.py", line 5, in <module>
import inquirer
ModuleNotFoundError: No module named 'inquirer'
Of course, because then it runs outside of the virtualenv.
Now, I am sure it can be handled, but it's much better to just drop the dependency inquirer
- it isn't really required here.
@w2sv what do you think?
Alright, I'm merging this. Hope it works, or someone fixes it if it doesn't ;)
In Ubuntu 23.04:
There is no need for inquirer, so I removed the dependency.
python3-libevdev
exists though.