1

I upgraded my python to version 3.10, but when I was installing dependencies for one of my projects (which worked fine before), I got this error from hiredis (hiredis==2.0.0):

 ERROR: Command errored out with exit status 1:
   command: /home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/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'"'"'))' bdist_wheel -d /tmp/pip-wheel-11hzakag
       cwd: /tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/
  Complete output (27 lines):
  /tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/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/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/lib/python3.10/site-packages/setuptools/dist.py:691: 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 bdist_wheel
  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 -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ivendor -I/home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/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
  ----------------------------------------
  ERROR: Failed building wheel for hiredis

I'm not sure what the problem is, could anyone help?

Sajad Rezvani
  • 366
  • 2
  • 14

1 Answers1

-2

if your version of python is 3.9 :

py -3.9 -m pip install --upgrade pip 

py -3.9 -m pip install hiredis

that work for me if doesnt work try :

py -3.9 -m pip uninstall hiredis