Search code examples
pythondjangoredispipdjango-channels

pip won't install channels_redis


for working with Django channels I need to install "channels_redis". while installing "channels_redis" I face this error, any thought?

by the way, I'm on windows and it showed me an error of C++ first and after installing Microsoft visual studio build tools vanished, and now this.

  ERROR: Command errored out with exit status 1:
   command: 'E:\Programming projects\Django\channels\chat_launch01\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0]
 = '"'"'C:\\Users\\KaNi\\AppData\\Local\\Temp\\pip-install-dt2d0_z3\\hiredis_a7d15f1044b343288a4bc87864c6418e\\setup.py'"'"'; __file__='"'"'C:\\
Users\\KaNi\\AppData\\Local\\Temp\\pip-install-dt2d0_z3\\hiredis_a7d15f1044b343288a4bc87864c6418e\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"
'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d
 'C:\Users\KaNi\AppData\Local\Temp\pip-wheel-m0bnautd'
       cwd: C:\Users\KaNi\AppData\Local\Temp\pip-install-dt2d0_z3\hiredis_a7d15f1044b343288a4bc87864c6418e\
  Complete output (23 lines):
  C:\Users\KaNi\AppData\Local\Temp\pip-install-dt2d0_z3\hiredis_a7d15f1044b343288a4bc87864c6418e\setup.py:7: DeprecationWarning: the imp module
is deprecated in favour of importlib; see the module's documentation for alternative uses
    import sys, imp, os, glob, io
  E:\Programming projects\Django\channels\chat_launch01\venv\lib\site-packages\setuptools\dist.py:642: UserWarning: Usage of dash-separated 'des
cription-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.win-amd64-3.9
  creating build\lib.win-amd64-3.9\hiredis
  copying hiredis\version.py -> build\lib.win-amd64-3.9\hiredis
  copying hiredis\__init__.py -> build\lib.win-amd64-3.9\hiredis
  running build_ext
  building 'hiredis.hiredis' extension
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\src
  creating build\temp.win-amd64-3.9\Release\vendor
  creating build\temp.win-amd64-3.9\Release\vendor\hiredis
  d:\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ivendor -IE:\
Programming projects\Django\channels\chat_launch01\venv\include -Ic:\users\kani\appdata\local\programs\python\python39\include -Ic:\users\kani\a
ppdata\local\programs\python\python39\include -Id:\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10240.0\ucrt /Tcsrc\hiredis.c /Fobuild\temp.win-amd64-3.9\Release\src\hiredis.obj
  hiredis.c
  c:\users\kani\appdata\local\programs\python\python39\include\pyconfig.h(200): fatal error C1083: Cannot open include file: 'basetsd.h': No suc
h file or directory
  error: command 'd:\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit code
2
  ----------------------------------------
  ERROR: Failed building wheel for hiredis

Solution

  • This happens because there is some problem with your build tools. Therefore,

    1. If your build tools further not answering to your problem, try to install build tools manually through this link.

    2. After that, you have to restart your PC or laptop.

    3. Then try to run your code again