PIP errors out when installing pynput

PIP just errors out mid-way through the installation of certain modules. This isn’t the first time it’s done this.

Here’s what it gave me:

$ pip install pynput

Collecting pynput
  Downloading pynput-1.7.6-py2.py3-none-any.whl (89 kB)
     |███▊                            | 10 kB 11.1 MB/s eta 
     |███████▍                        | 20 kB 16.5 MB/s eta 
     |███████████                     | 30 kB 18.1 MB/s eta 
     |██████████████▊                 | 40 kB 8.8 MB/s eta 0
     |██████████████████▍             | 51 kB 10.3 MB/s eta 
     |██████████████████████          | 61 kB 11.8 MB/s eta 
     |█████████████████████████▊      | 71 kB 12.3 MB/s eta 
     |█████████████████████████████▍  | 81 kB 13.6 MB/s eta 
     |████████████████████████████████| 89 kB 14.4 MB/s 
Collecting evdev>=1.3
  Downloading evdev-1.6.1.tar.gz (26 kB)
Requirement already satisfied: six in ./.pythonlibs/lib/python3.10/site-packages (from pynput) (1.16.0)
Requirement already satisfied: python-xlib>=0.17 in ./.pythonlibs/lib/python3.10/site-packages (from pynput) (0.33)
Using legacy 'setup.py install' for evdev, since package 'wheel' is not installed.
Installing collected packages: evdev, pynput
    Running setup.py install for evdev ... error
    ERROR: Command errored out with exit status 1:
     command: /nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uad9lfnj/evdev_8dafb442b5c6418ea7b3ffdfcc62d383/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uad9lfnj/evdev_8dafb442b5c6418ea7b3ffdfcc62d383/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-rnsqzdnw/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/runner/CLI-GUI/.pythonlibs/include/python3.10/evdev
         cwd: /tmp/pip-install-uad9lfnj/evdev_8dafb442b5c6418ea7b3ffdfcc62d383/
    Complete output (39 lines):
    running install
    /nix/store/icx0zbk2r2qrpnqpd41q4h4xzr856d4f-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-cpython-310
    creating build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/__init__.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/device.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/ecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/eventio.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/eventio_async.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/events.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/evtest.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/ff.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/genecodes.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/uinput.py -> build/lib.linux-x86_64-cpython-310/evdev
    copying evdev/util.py -> build/lib.linux-x86_64-cpython-310/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
    ----------------------------------------
ERROR: Command errored out with exit status 1: /nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uad9lfnj/evdev_8dafb442b5c6418ea7b3ffdfcc62d383/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uad9lfnj/evdev_8dafb442b5c6418ea7b3ffdfcc62d383/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-rnsqzdnw/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/runner/CLI-GUI/.pythonlibs/include/python3.10/evdev Check the logs for full command output.

Hi @NoahWilhoite , welcome to the forums!
pip is known to be buggy and unreliable. Instead, try using poetry add pynput to install pynput correctly.
You can see that pip tries to install with setup.py, which won’t work.

1 Like

Specifically on Replit, as it’s typically fine locally.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.