Closed ghost closed 3 years ago
does sudo pip3 install evdev
work? If it doesn't, then this belongs to https://github.com/gvalkov/python-evdev
I'm not an expert on compiling c, I won't be able to help there.
Someone should make an rpm package for key-mapper, but I don't have fedora and don't know how it can be done.
Came here with the same error, trying to install evdev directly as suggested returns an error on Fedora 34:
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i8auqh88/evdev_b3aa8213981748079f7b6c18262805ec/setup.py'"'"'; file='"'"'/tmp/pip-install-i8auqh88/evdev_b3aa8213981748079f7b6c18262805ec/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-d_vwjrlc/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/evdev Check the logs for full command output.
I've submitted an issue on the evdev page you linked. Cheers! ~M
you two might need the package python3-devel
you can check if it is installed with dnf history userinstalled | grep python
@Underknowledge: Thanks! Solved for me! And you @RistrettoMike ?
$ sudo pip install git+https://github.com/sezanzeb/key-mapper.git
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting git+https://github.com/sezanzeb/key-mapper.git
Cloning https://github.com/sezanzeb/key-mapper.git to /tmp/pip-req-build-3pe89vqw
Running command git clone -q https://github.com/sezanzeb/key-mapper.git /tmp/pip-req-build-3pe89vqw
Requirement already satisfied: setuptools in /usr/lib/python3.9/site-packages (from key-mapper==1.0.0) (53.0.0)
Collecting evdev
Using cached evdev-1.4.0.tar.gz (26 kB)
Requirement already satisfied: pydbus in /usr/local/lib/python3.9/site-packages (from key-mapper==1.0.0) (0.6.0)
Requirement already satisfied: pygobject in /usr/lib64/python3.9/site-packages (from key-mapper==1.0.0) (3.40.1)
Building wheels for collected packages: key-mapper, evdev
Building wheel for key-mapper (setup.py) ... done
Created wheel for key-mapper: filename=key_mapper-1.0.0-py3-none-any.whl size=130682 sha256=d03e8a97d814b923ae2bb3124399dd80c6c8e3b2601fce6cc0bb31921bdcf100
Stored in directory: /tmp/pip-ephem-wheel-cache-vye3ri0j/wheels/36/95/0a/bfefa836ed3bba5ca75362c8defaed75a76808e9811cce108c
Building wheel for evdev (setup.py) ... done
Created wheel for evdev: filename=evdev-1.4.0-cp39-cp39-linux_x86_64.whl size=84220 sha256=e470ae39c45e72793c97f8e2d7a409becab41388e54073cda4e2cc4946b97c74
Stored in directory: /root/.cache/pip/wheels/b8/73/36/8c8d7ae588c7670bd787e7819b6ad1442d6f75b23e6912459c
Successfully built key-mapper evdev
Installing collected packages: evdev, key-mapper
Successfully installed evdev-1.4.0 key-mapper-1.0.0
But now there is a new problem... @RistrettoMike: do you also get this error?
$ sudo systemctl enable key-mapper
Failed to enable unit: Unit file key-mapper.service does not exist.
try
sudo systemctl daemon-reload
sudo systemctl enable key-mapper
sudo systemctl start key-mapper
Not work...
$ sudo systemctl daemon-reload
$ sudo systemctl enable key-mapper
Failed to enable unit: Unit file key-mapper.service does not exist.
[Edit] Searching for "key-mapper"...
$ sudo find / -name *key-mapper*
/usr/local/lib/python3.9/site-packages/usr/lib/systemd/system/key-mapper.service
/usr/local/lib/python3.9/site-packages/usr/lib/udev/rules.d/key-mapper.rules
/usr/local/lib/python3.9/site-packages/usr/bin/key-mapper-control
/usr/local/lib/python3.9/site-packages/usr/bin/key-mapper-helper
/usr/local/lib/python3.9/site-packages/usr/bin/key-mapper-gtk
/usr/local/lib/python3.9/site-packages/usr/bin/key-mapper-service
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper-large.png
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/lang/it_IT/LC_MESSAGES/key-mapper.mo
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/lang/sk_SK/LC_MESSAGES/key-mapper.mo
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper.glade
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper.service
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper.svg
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper-autoload.desktop
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper.policy
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper.rules
/usr/local/lib/python3.9/site-packages/usr/share/key-mapper/key-mapper.desktop
/usr/local/lib/python3.9/site-packages/usr/share/applications/key-mapper.desktop
/usr/local/lib/python3.9/site-packages/usr/share/polkit-1/actions/key-mapper.policy
/usr/local/lib/python3.9/site-packages/etc/xdg/autostart/key-mapper-autoload.desktop
Yeah, I have seen that before, I don't know why some distributions decide to put that stuff into site-packages. Setup.py clearly has absolute paths in it: https://github.com/sezanzeb/key-mapper/blob/main/setup.py#L101
Until someone decides to make an .rpm package it will continue being that way for some fedora users.
But you can try to use
sudo python3 setup.py install
. It will be a pain to uninstall, but maybe that works
Did I do something wrong? Did I run setup.py in the right folder?
# cd /usr/local/lib/python3.9/site-packages/
# ls -l
drwxr-xr-x. 4 root root 4096 set 6 01:15 etc
drwxr-xr-x. 6 root root 4096 set 6 01:15 keymapper
drwxr-xr-x. 2 root root 4096 set 6 01:15 key_mapper-1.0.0.dist-info
drwxr-xr-x. 3 root root 4096 set 3 02:02 pydbus
drwxr-xr-x. 2 root root 4096 set 3 02:02 pydbus-0.6.0.dist-info
-rw-r--r--. 1 user user 3623 set 6 14:54 setup.py
drwxr-xr-x. 5 root root 4096 set 6 01:15 usr
# python3 setup.py install
running install
fatal: not a git repository (or any of the parent directories): .git
running build
running build_py
creating build
creating build/lib
creating build/lib/keymapper
copying keymapper/groups.py -> build/lib/keymapper
copying keymapper/mapping.py -> build/lib/keymapper
copying keymapper/utils.py -> build/lib/keymapper
copying keymapper/__init__.py -> build/lib/keymapper
copying keymapper/logger.py -> build/lib/keymapper
copying keymapper/data.py -> build/lib/keymapper
copying keymapper/key.py -> build/lib/keymapper
copying keymapper/config.py -> build/lib/keymapper
copying keymapper/state.py -> build/lib/keymapper
copying keymapper/presets.py -> build/lib/keymapper
copying keymapper/paths.py -> build/lib/keymapper
copying keymapper/user.py -> build/lib/keymapper
copying keymapper/daemon.py -> build/lib/keymapper
creating build/lib/keymapper/gui
copying keymapper/gui/reader.py -> build/lib/keymapper/gui
copying keymapper/gui/__init__.py -> build/lib/keymapper/gui
copying keymapper/gui/row.py -> build/lib/keymapper/gui
copying keymapper/gui/window.py -> build/lib/keymapper/gui
copying keymapper/gui/helper.py -> build/lib/keymapper/gui
creating build/lib/keymapper/ipc
copying keymapper/ipc/__init__.py -> build/lib/keymapper/ipc
copying keymapper/ipc/socket.py -> build/lib/keymapper/ipc
copying keymapper/ipc/pipe.py -> build/lib/keymapper/ipc
creating build/lib/keymapper/injection
copying keymapper/injection/macros.py -> build/lib/keymapper/injection
copying keymapper/injection/__init__.py -> build/lib/keymapper/injection
copying keymapper/injection/keycode_mapper.py -> build/lib/keymapper/injection
copying keymapper/injection/numlock.py -> build/lib/keymapper/injection
copying keymapper/injection/event_producer.py -> build/lib/keymapper/injection
copying keymapper/injection/injector.py -> build/lib/keymapper/injection
copying keymapper/injection/context.py -> build/lib/keymapper/injection
running egg_info
creating key_mapper.egg-info
writing key_mapper.egg-info/PKG-INFO
writing dependency_links to key_mapper.egg-info/dependency_links.txt
writing requirements to key_mapper.egg-info/requires.txt
writing top-level names to key_mapper.egg-info/top_level.txt
writing manifest file 'key_mapper.egg-info/SOURCES.txt'
reading manifest file 'key_mapper.egg-info/SOURCES.txt'
writing manifest file 'key_mapper.egg-info/SOURCES.txt'
running install_lib
running install_data
creating /usr/share/key-mapper
error: can't copy 'data/key-mapper.desktop': doesn't exist or not a regular file
# systemctl enable key-mapper
Failed to enable unit: Unit file key-mapper.service does not exist.
# cd /usr/share/key-mapper/
# ls -l
total 0
You should run sudo python3 setup.py install
in the folder cloned from git
you could also try sudo pip install --no-binary :all: git+https://github.com/sezanzeb/key-mapper.git
(https://stackoverflow.com/a/46087545)
Most recent thing I tried was manually cloning the git folder (which wouldn't actually occur using the sudo pip install git+https://github.com/sezanzeb/key-mapper.git
command from the readme) then running the sudo python3 setup.py install
command which returned this:
running install
generating translation for it_IT
generating translation for sk_SK
running build
running build_py
copying keymapper/commit_hash.py -> build/lib/keymapper
running egg_info
writing key_mapper.egg-info/PKG-INFO
writing dependency_links to key_mapper.egg-info/dependency_links.txt
writing requirements to key_mapper.egg-info/requires.txt
writing top-level names to key_mapper.egg-info/top_level.txt
reading manifest file 'key_mapper.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'key_mapper.egg-info/SOURCES.txt'
running install_lib
copying build/lib/keymapper/commit_hash.py -> /usr/local/lib/python3.9/site-packages/keymapper
byte-compiling /usr/local/lib/python3.9/site-packages/keymapper/commit_hash.py to commit_hash.cpython-39.pyc
running install_data
copying mo/it_IT/key-mapper.mo -> /usr/share/key-mapper/lang/it_IT/LC_MESSAGES
copying mo/sk_SK/key-mapper.mo -> /usr/share/key-mapper/lang/sk_SK/LC_MESSAGES
running install_egg_info
removing '/usr/local/lib/python3.9/site-packages/key_mapper-1.0.0-py3.9.egg-info' (and everything under it)
Copying key_mapper.egg-info to /usr/local/lib/python3.9/site-packages/key_mapper-1.0.0-py3.9.egg-info
running install_scripts
I then followed that up with the sudo systemctl enable key-mapper
which returned:
Created symlink /etc/systemd/system/key-mapper.service → /usr/lib/systemd/system/key-mapper.service.
Created symlink /etc/systemd/system/default.target.wants/key-mapper.service → /usr/lib/systemd/system/key-mapper.service.
and finally sudo systemctl restart key-mapper
which throws this error:
Job for key-mapper.service failed because the control process exited with error code.
See "systemctl status key-mapper.service" and "journalctl -xeu key-mapper.service" for details.
When reporting that error using the suggest systemctl command there it gives back this:
× key-mapper.service - Service to inject keycodes without the GUI application
Loaded: loaded (/usr/lib/systemd/system/key-mapper.service; enabled; vendor preset: disab>
Active: failed (Result: exit-code) since Tue 2021-09-07 08:19:30 EDT; 4min 20s ago
Process: 25181 ExecStart=/usr/bin/key-mapper-service (code=exited, status=1/FAILURE)
Main PID: 25181 (code=exited, status=1/FAILURE)
CPU: 258ms
Sep 07 08:19:30 x270 key-mapper-service[25181]: File "/usr/bin/key-mapper-service", line 48,>
Sep 07 08:19:30 x270 key-mapper-service[25181]: from keymapper.daemon import Daemon
Sep 07 08:19:30 x270 key-mapper-service[25181]: File "/usr/local/lib/python3.9/site-packages>
Sep 07 08:19:30 x270 key-mapper-service[25181]: from keymapper.injection.injector import I>
Sep 07 08:19:30 x270 key-mapper-service[25181]: File "/usr/local/lib/python3.9/site-packages>
Sep 07 08:19:30 x270 key-mapper-service[25181]: import evdev
Sep 07 08:19:30 x270 key-mapper-service[25181]: ModuleNotFoundError: No module named 'evdev'
Sep 07 08:19:30 x270 systemd[1]: key-mapper.service: Main process exited, code=exited, status=>
Sep 07 08:19:30 x270 systemd[1]: key-mapper.service: Failed with result 'exit-code'.
Sep 07 08:19:30 x270 systemd[1]: Failed to start Service to inject keycodes without the GUI ap>
So it looks like it's still an evdev error to me. I have yet to try your final command suggested above - so I'll try that next.
Cheers folks, ~M
Also running fedora 34 and I have to say, I had no problems installing it via sudo pip install git+https://github.com/sezanzeb/key-mapper.git
Might be related to something I already had installed.
@RistrettoMike
So it looks like it's still an evdev error to me. I have yet to try your final command suggested above - so I'll try that next.
Did you follow the advice here https://github.com/sezanzeb/key-mapper/issues/181#issuecomment-913223933 with the python3-devel
package?
Afterwards I guess sudo pip3 install evdev
should work
There is also a python3-evdev
package in fedora apparently: https://fedora.pkgs.org/34/fedora-x86_64/python3-evdev-1.1.2-10.fc34.x86_64.rpm.html, which should also work
@RistrettoMike
So it looks like it's still an evdev error to me. I have yet to try your final command suggested above - so I'll try that next.
Did you follow the advice here #181 (comment) with the
python3-devel
package?
Starting over & beginning with that python3-devel package before then following the regular readme solved the issue for me on Fedora 34. I have Key Mapper open now & am working on learning the syntax for mapping key combos :) Thanks folks!
Cheers,
~M
you could also try
sudo pip install --no-binary :all: git+https://github.com/sezanzeb/key-mapper.git
(https://stackoverflow.com/a/46087545)
$ sudo pip install --no-binary :all: git+https://github.com/sezanzeb/key-mapper.git
Collecting git+https://github.com/sezanzeb/key-mapper.git
Cloning https://github.com/sezanzeb/key-mapper.git to /tmp/pip-req-build-kaou9v8q
Running command git clone -q https://github.com/sezanzeb/key-mapper.git /tmp/pip-req-build-kaou9v8q
Requirement already satisfied: setuptools in /usr/lib/python3.9/site-packages (from key-mapper==1.0.0) (53.0.0)
Requirement already satisfied: evdev in /usr/local/lib64/python3.9/site-packages (from key-mapper==1.0.0) (1.4.0)
Requirement already satisfied: pydbus in /usr/local/lib/python3.9/site-packages (from key-mapper==1.0.0) (0.6.0)
Requirement already satisfied: pygobject in /usr/lib64/python3.9/site-packages (from key-mapper==1.0.0) (3.40.1)
$ sudo systemctl enable key-mapper
Failed to enable unit: Unit file key-mapper.service does not exist.
$ sudo pip list
Package Version
------------------ ----------
...
key-mapper 1.0.0
...
$ sudo pip uninstall key-mapper
Found existing installation: key-mapper 1.0.0
Can't uninstall 'key-mapper'. No files were found to uninstall.
@rafacure then try
git clone https://github.com/sezanzeb/key-mapper.git
cd key-mapper
sudo python3 setup.py install
sudo systemctl enable key-mapper
EDIT:
use
git clone https://github.com/sezanzeb/input-remapper.git
cd input-remapper
sudo python3 setup.py install
sudo systemctl enable input-remapper
beware that uninstalling is not easy with this method, since there is no package manager managing the files with setup.py install
@rafacure then try
git clone https://github.com/sezanzeb/key-mapper.git cd key-mapper sudo python3 setup.py install sudo systemctl enable key-mapper
Solved! Thank you all!
Just wanted to confirm that on a fresh re-install of Fedora 34 I was able to install key-mapper first try by initially running
sudo dnf install python3-devel
followed by
git clone https://github.com/sezanzeb/key-mapper.git
sudo systemctl enable key-mapper
sudo systemctl restart key-mapper
Seems like whatever Fedora didn't have built-in was solved with the python3-devel package. I just wanted to confirm for anyone who had the same issue still. Thanks again for the help & Cheers!
~M
Hi,
When trying to install evdev via pip I get similar error. I consulted bug #171 but couldn't establish equivalence. Thanks in advance for any help.