redis/hiredis-py

Can't install hiredis

Antonio1C opened this issue · 2 comments

Hello
Linux/Ubuntu 20.04 on VirtualBox
python 3.10.4
pip 22.1.2
hiredis 2.0.0
When I try to install using pip, I get an error

Running setup.py install for hiredis ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for hiredis did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      /tmp/pip-install-eksavwc2/hiredis_c4ea8b84e80e43389798949337b4d313/setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
        import sys, imp, os, glob, io
      /home/antonio/yandex/sprint4/env/lib/python3.10/site-packages/setuptools/dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/hiredis
      copying hiredis/__init__.py -> build/lib.linux-x86_64-3.10/hiredis
      copying hiredis/version.py -> build/lib.linux-x86_64-3.10/hiredis
      copying hiredis/hiredis.pyi -> build/lib.linux-x86_64-3.10/hiredis
      copying hiredis/py.typed -> build/lib.linux-x86_64-3.10/hiredis
      running build_ext
      building 'hiredis.hiredis' extension
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      creating build/temp.linux-x86_64-3.10/vendor
      creating build/temp.linux-x86_64-3.10/vendor/hiredis
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ivendor -I/home/antonio/yandex/sprint4/env/include -I/usr/include/python3.10 -c src/hiredis.c -o build/temp.linux-x86_64-3.10/src/hiredis.o
      In file included from src/hiredis.c:1:
      src/hiredis.h:4:10: fatal error: Python.h: No such file or directory
          4 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-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: legacy-install-failure

× Encountered error while trying to install package.
╰─> hiredis

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Pls, help

Hi, I'm not all that familiar with Python, but do you perhaps need the -dev packages?

Possibly relevant SO question

Hi, I'm not all that familiar with Python, but do you perhaps need the -dev packages?

Possibly relevant SO question

Thank you! Command sudo apt-get install python3.10-dev helps.