Skip to content

'error: failed-wheel-build-for-install' when installing from pip #659

@Adam-Color

Description

@Adam-Color

Description
Installing from pip results in an error

Platform and pynput version
Your operating system and version, and the version of pynput.

arm-based Fedora Linux 42 (Hyprland), running on a mac OS vm via UTM

Python 3.10.11 in a venv

To Reproduce
If possible, please include a short standalone code sample that reproduces the bug. Remember to surround it with code block markers to maintain indentation!

run this in the terminal:

pip install pynput

results in this output:

Collecting pynput
  Using cached pynput-1.8.1-py2.py3-none-any.whl.metadata (32 kB)
Collecting six (from pynput)
  Using cached six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting evdev>=1.3 (from pynput)
  Using cached evdev-1.9.2.tar.gz (33 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting python-xlib>=0.17 (from pynput)
  Using cached python_xlib-0.33-py2.py3-none-any.whl.metadata (6.2 kB)
Using cached pynput-1.8.1-py2.py3-none-any.whl (91 kB)
Using cached python_xlib-0.33-py2.py3-none-any.whl (182 kB)
Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: evdev
  Building wheel for evdev (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for evdev (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [80 lines of output]
      /tmp/pip-build-env-7vu_ax78/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!
      
              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).
      
              By 2026-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        corresp(dist, value, root_dir)
      /tmp/pip-build-env-7vu_ax78/overlay/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: BSD License
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        dist._finalize_license_expression()
      /tmp/pip-build-env-7vu_ax78/overlay/lib/python3.10/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: BSD License
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        self._finalize_license_expression()
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/util.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/uinput.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/genecodes_py.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/genecodes_c.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/ff.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/evtest.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/events.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/eventio_async.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/eventio.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/ecodes_runtime.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/ecodes.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/device.py -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/__init__.py -> build/lib.linux-aarch64-cpython-310/evdev
      running egg_info
      writing src/evdev.egg-info/PKG-INFO
      writing dependency_links to src/evdev.egg-info/dependency_links.txt
      writing top-level names to src/evdev.egg-info/top_level.txt
      reading manifest file 'src/evdev.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching 'src/evdev/ecodes.c'
      adding license file 'LICENSE'
      writing manifest file 'src/evdev.egg-info/SOURCES.txt'
      copying src/evdev/input.c -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/py.typed -> build/lib.linux-aarch64-cpython-310/evdev
      copying src/evdev/uinput.c -> build/lib.linux-aarch64-cpython-310/evdev
      running build_ext
      running build_ecodes
      writing /tmp/pip-install-2imwiq8t/evdev_6fca08c8d585472fbee40e42449d3ffa/src/evdev/ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
      building 'evdev._input' extension
      creating build/temp.linux-aarch64-cpython-310/src/evdev
      gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -mbranch-protection=standard -fexceptions -mbranch-protection=standard -fexceptions -mbranch-protection=standard -fPIC -I/home/user/Documents/code/AppUsageGUI/.venv/include -I/usr/include/python3.10 -c src/evdev/input.c -o build/temp.linux-aarch64-cpython-310/src/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
      src/evdev/input.c:10:10: fatal error: Python.h: No such file or directory
         10 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for evdev
Failed to build evdev
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> evdev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions