Naoki
Naoki

Reputation: 1

Cannot install evdev==1.6.0 package on Ubuntu because of linux-headers?

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?

Upvotes: 0

Views: 3702

Answers (2)

Danylo
Danylo

Reputation: 1

Try running:

sudo apt-get install python3-dev

Upvotes: 0

Naoki
Naoki

Reputation: 1

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.

Upvotes: 0

Related Questions