0

I am stuck on installing evdev==1.6.0 python package on my Ubuntu20.04(Focal) AMD64 machine.

Firstly, I tried

$ pip install evdev==1.6.0

and then, I got a error message below.

Collecting evdev
  Using cached evdev-1.6.1.tar.gz (26 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: evdev
  Building wheel for evdev (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-37
      creating build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/util.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/device.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/ff.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/eventio_async.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/eventio.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/events.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/ecodes.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/evtest.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/__init__.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/uinput.py -> build/lib.linux-x86_64-cpython-37/evdev
      copying evdev/genecodes.py -> build/lib.linux-x86_64-cpython-37/evdev
      running build_ext
      running build_ecodes
      The 'linux/input.h' and 'linux/input-event-codes.h' include files
      are missing. You will have to install the kernel header files in
      order to continue:
      
          yum install kernel-headers-$(uname -r)
          apt-get install linux-headers-$(uname -r)
          emerge sys-kernel/linux-headers
          pacman -S kernel-headers
      
      In case they are installed in a non-standard location, you may use
      the '--evdev-headers' option to specify one or more colon-separated
      paths. For example:
      
          python setup.py \
            build \
            build_ecodes --evdev-headers path/input.h:path/input-event-codes.h \
            build_ext --include-dirs  path/ \
            install
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for evdev
  Running setup.py clean for evdev
Failed to build evdev
ERROR: Could not build wheels for evdev, which is required to install pyproject.toml-based projects

Following the message I tried

 $sudo apt-get install linux-headers-$(uname -r)

and the message said it is up-to-date.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-5.15.0-76-generic is already the newest version (5.15.0-76.83~20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Does anyone know a solution or something to try next?

Naoki
  • 1

1 Answers1

0

Finally, I found that my header files, which are input.h and input-event-codes.h were in the wrong place. I searched the location and copied and pasted the into "/usr/include/linux/" and install gcc, evdev were successfully installed. Thank you for your comments.

Naoki
  • 1
  • Copying files under `/usr` (_anywhere_ in `/usr` except `/usr/local`) is generally a Bad Idea and makes for problems in the future. Better to make sure the place the files exist is added to your include path (for example, in some distros -- I don't remember offhand if Ubuntu is one of them -- there's a per-kernel-version header link in the same tree as modules; and if you're using a kernel module build framework like DKMS correctly, that location will be added to your compiler's path automatically). – Charles Duffy Jul 18 '23 at 16:04