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 projectsDjangochannelschat_launch01venvScriptspython.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d
'C:UsersKaNiAppDataLocalTemppip-wheel-m0bnautd'
cwd: C:UsersKaNiAppDataLocalTemppip-install-dt2d0_z3hiredis_a7d15f1044b343288a4bc87864c6418e
Complete output (23 lines):
C:UsersKaNiAppDataLocalTemppip-install-dt2d0_z3hiredis_a7d15f1044b343288a4bc87864c6418esetup.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 projectsDjangochannelschat_launch01venvlibsite-packagessetuptoolsdist.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 buildlib.win-amd64-3.9
creating buildlib.win-amd64-3.9hiredis
copying hiredisversion.py -> buildlib.win-amd64-3.9hiredis
copying hiredis__init__.py -> buildlib.win-amd64-3.9hiredis
running build_ext
building 'hiredis.hiredis' extension
creating buildtemp.win-amd64-3.9
creating buildtemp.win-amd64-3.9Release
creating buildtemp.win-amd64-3.9Releasesrc
creating buildtemp.win-amd64-3.9Releasevendor
creating buildtemp.win-amd64-3.9Releasevendorhiredis
d:Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.28.29910binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ivendor -IE:
Programming projectsDjangochannelschat_launch01venvinclude -Ic:userskaniappdatalocalprogramspythonpython39include -Ic:userskania
ppdatalocalprogramspythonpython39include -Id:Microsoft Visual Studio2019BuildToolsVCToolsMSVC14.28.29910include -IC:Program Files
(x86)Windows Kits10include10.0.10240.0ucrt /Tcsrchiredis.c /Fobuildtemp.win-amd64-3.9Releasesrchiredis.obj
hiredis.c
c:userskaniappdatalocalprogramspythonpython39includepyconfig.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
5
Answers
finally i used docker image to solve this problem
install docker
run docker desktop
in terminal enter the following line
docker run -p 5432:5432 -d --name redis redis
This happens because there is some problem with your build tools. Therefore,
If your build tools further not answering to your problem, try to install build tools manually through this link.
After that, you have to restart your PC or laptop.
Then try to run your code again
The issue comes when in your windows system you are trying to install channels_redis in venv Python environment and not in the main system,
Try to install and run the project outside any virtual environment i.e into the main system.
When I use python version python-3.10.5 I’m getting the same error and I tried all things but couldn’t work, so I changed my python version to python-3.7.3 and it worked.
Error occurs when building hiredis.
Make sure Python development headers are available when installing hiredis-py. On Ubuntu/Debian systems, install them with
apt-get install python3-dev
.