redis / hiredis-py

Python wrapper for hiredis
MIT License
496 stars 102 forks source link

build hiredis failed with Python3.6.2 macOS #62

Closed DheerajAgarwal closed 6 years ago

DheerajAgarwal commented 6 years ago

Hi,

can't install hiredis which fails at building wheel. Please advise.

wheel 0.29.0 py36h3597b6d_1

pip install hiredis
Collecting hiredis
  Using cached hiredis-0.2.0.tar.gz
Building wheels for collected packages: hiredis
  Running setup.py bdist_wheel for hiredis ... error
  Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/yy/_lh_xrrx7r92m999snj4dt1nvs_f1b/T/pip-build-im8m7cxh/hiredis/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 /var/folders/yy/_lh_xrrx7r92m999snj4dt1nvs_f1b/T/tmplgz4f1q6pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.6
  creating build/lib.macosx-10.9-x86_64-3.6/hiredis
  copying hiredis/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/hiredis
  copying hiredis/version.py -> build/lib.macosx-10.9-x86_64-3.6/hiredis
  running build_clib
  building 'hiredis_for_hiredis_py' library
  creating build/temp.macosx-10.9-x86_64-3.6
  creating build/temp.macosx-10.9-x86_64-3.6/vendor
  creating build/temp.macosx-10.9-x86_64-3.6/vendor/hiredis
  /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -c vendor/hiredis/read.c -o build/temp.macosx-10.9-x86_64-3.6/vendor/hiredis/read.o
  /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -c vendor/hiredis/sds.c -o build/temp.macosx-10.9-x86_64-3.6/vendor/hiredis/sds.o
  x86_64-apple-darwin13.4.0-ar rc build/temp.macosx-10.9-x86_64-3.6/libhiredis_for_hiredis_py.a build/temp.macosx-10.9-x86_64-3.6/vendor/hiredis/read.o build/temp.macosx-10.9-x86_64-3.6/vendor/hiredis/sds.o
  unable to execute 'x86_64-apple-darwin13.4.0-ar': No such file or directory
  error: command 'x86_64-apple-darwin13.4.0-ar' failed with exit status 1

  ----------------------------------------
  Failed building wheel for hiredis
badboy commented 6 years ago

unable to execute 'x86_64-apple-darwin13.4.0-ar': No such file or directory

You need a working development environment, including a compiler, linker and other necessary tools. I don't use a Mac and thus have no idea what to install, but probably xcode is a good answer here.

DheerajAgarwal commented 6 years ago

I have xcode, and other development tools. I was trying to run this in a virtual environment when I ran into this issue. I have subsequently tried it on root and still the same.

DheerajAgarwal commented 6 years ago

Actually I have x86_64-apple-darwin16.7.0 which from Xcode9. Looks like the redis is looking for an older version. As per Xcode clang version, looks like redis (or wheel) is looking for # Xcode 6.0.1 (6A317) Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)

badboy commented 6 years ago

I don't use any macos, so I can't really help with your problem, sorry.

piotrgrundas commented 6 years ago

Same on ubuntu 17.04 and python 3.6.1

pip install hiredis
Collecting hiredis
  Using cached hiredis-0.2.0.tar.gz
Building wheels for collected packages: hiredis
  Running setup.py bdist_wheel for hiredis ... error
  Complete output from command /home/pete/.virtualenvs/test/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fdl026_h/hiredis/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 /tmp/tmpmbs6wzj5pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/hiredis
  copying hiredis/version.py -> build/lib.linux-x86_64-3.6/hiredis
  copying hiredis/__init__.py -> build/lib.linux-x86_64-3.6/hiredis
  running build_clib
  building 'hiredis_for_hiredis_py' library
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/vendor
  creating build/temp.linux-x86_64-3.6/vendor/hiredis
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-fWqO4P/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -c vendor/hiredis/read.c -o build/temp.linux-x86_64-3.6/vendor/hiredis/read.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-fWqO4P/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -c vendor/hiredis/sds.c -o build/temp.linux-x86_64-3.6/vendor/hiredis/sds.o
  x86_64-linux-gnu-ar rc build/temp.linux-x86_64-3.6/libhiredis_for_hiredis_py.a build/temp.linux-x86_64-3.6/vendor/hiredis/read.o build/temp.linux-x86_64-3.6/vendor/hiredis/sds.o
  running build_ext
  building 'hiredis.hiredis' extension
  creating build/temp.linux-x86_64-3.6/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-fWqO4P/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ivendor -I/usr/include/python3.6m -I/home/pete/.virtualenvs/test/include/python3.6m -c src/reader.c -o build/temp.linux-x86_64-3.6/src/reader.o
  In file included from src/reader.h:4:0,
                   from src/reader.c:1:
  src/hiredis.h:4:20: fatal error: Python.h: Nie ma takiego pliku ani katalogu
   #include <Python.h>
                      ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for hiredis
  Running setup.py clean for hiredis
Failed to build hiredis
Installing collected packages: hiredis
  Running setup.py install for hiredis ... error
    Complete output from command /home/pete/.virtualenvs/test/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fdl026_h/hiredis/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-cb3nah3u-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pete/.virtualenvs/test/include/site/python3.6/hiredis:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/hiredis
    copying hiredis/version.py -> build/lib.linux-x86_64-3.6/hiredis
    copying hiredis/__init__.py -> build/lib.linux-x86_64-3.6/hiredis
    running build_clib
    building 'hiredis_for_hiredis_py' library
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/vendor
    creating build/temp.linux-x86_64-3.6/vendor/hiredis
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-fWqO4P/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -c vendor/hiredis/read.c -o build/temp.linux-x86_64-3.6/vendor/hiredis/read.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-fWqO4P/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -c vendor/hiredis/sds.c -o build/temp.linux-x86_64-3.6/vendor/hiredis/sds.o
    x86_64-linux-gnu-ar rc build/temp.linux-x86_64-3.6/libhiredis_for_hiredis_py.a build/temp.linux-x86_64-3.6/vendor/hiredis/read.o build/temp.linux-x86_64-3.6/vendor/hiredis/sds.o
    running build_ext
    building 'hiredis.hiredis' extension
    creating build/temp.linux-x86_64-3.6/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-fWqO4P/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ivendor -I/usr/include/python3.6m -I/home/pete/.virtualenvs/test/include/python3.6m -c src/reader.c -o build/temp.linux-x86_64-3.6/src/reader.o
    In file included from src/reader.h:4:0,
                     from src/reader.c:1:
    src/hiredis.h:4:20: fatal error: Python.h: Nie ma takiego pliku ani katalogu
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/pete/.virtualenvs/test/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fdl026_h/hiredis/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-cb3nah3u-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pete/.virtualenvs/test/include/site/python3.6/hiredis" failed with error code 1 in /tmp/pip-build-fdl026_h/hiredis/
badboy commented 6 years ago

@piotrgrundas That's actually a completely different error. Looks like you're missing the required python development package. Run

apt-get install python3-dev 
SURUPAM commented 6 years ago

when i runed it it showing cli.exe error no such file on windows

C:\cointrol>pip install hiredis
Collecting hiredis
  Using cached hiredis-0.2.0.tar.gz
Building wheels for collected packages: hiredis
  Running setup.py bdist_wheel for hiredis ... error
  Complete output from command c:\users\surupamchandra\appdata\local\programs\py
thon\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\
\SURUPA~1\\AppData\\Local\\Temp\\pip-build-kz1f68iz\\hiredis\\setup.py';f=getatt
r(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close(
);exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SURUPA~1\AppDat
a\Local\Temp\tmp2wa0by5tpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\hiredis
  copying hiredis\version.py -> build\lib.win-amd64-3.6\hiredis
  copying hiredis\__init__.py -> build\lib.win-amd64-3.6\hiredis
  running build_clib
  building 'hiredis_for_hiredis_py' library
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\vendor
  creating build\temp.win-amd64-3.6\vendor\hiredis
  cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD /Tcvendor/hiredis/read.c /Fobuild\t
emp.win-amd64-3.6\vendor/hiredis/read.obj
  error: command 'cl.exe' failed: No such file or directory

  ----------------------------------------
  Failed building wheel for hiredis
  Running setup.py clean for hiredis
Failed to build hiredis
Installing collected packages: hiredis
  Running setup.py install for hiredis ... error
    Complete output from command c:\users\surupamchandra\appdata\local\programs\
python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\User
s\\SURUPA~1\\AppData\\Local\\Temp\\pip-build-kz1f68iz\\hiredis\\setup.py';f=geta
ttr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.clos
e();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SURUPA~1\Ap
pData\Local\Temp\pip-ddiiiypw-record\install-record.txt --single-version-externa
lly-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\hiredis
    copying hiredis\version.py -> build\lib.win-amd64-3.6\hiredis
    copying hiredis\__init__.py -> build\lib.win-amd64-3.6\hiredis
    running build_clib
    building 'hiredis_for_hiredis_py' library
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\vendor
    creating build\temp.win-amd64-3.6\vendor\hiredis
    cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD /Tcvendor/hiredis/read.c /Fobuild
\temp.win-amd64-3.6\vendor/hiredis/read.obj
    error: command 'cl.exe' failed: No such file or directory

    ----------------------------------------
Command "c:\users\surupamchandra\appdata\local\programs\python\python36\python.e
xe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SURUPA~1\\AppData\\Lo
cal\\Temp\\pip-build-kz1f68iz\\hiredis\\setup.py';f=getattr(tokenize, 'open', op
en)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, _
_file__, 'exec'))" install --record C:\Users\SURUPA~1\AppData\Local\Temp\pip-ddi
iiypw-record\install-record.txt --single-version-externally-managed --compile" f
ailed with error code 1 in C:\Users\SURUPA~1\AppData\Local\Temp\pip-build-kz1f68
iz\hiredis\

C:\cointrol>
badboy commented 6 years ago

@SURUPAM You're not on macOS, so again this is a different problem. error: command 'cl.exe' failed: No such file or directory -> You're missing the required build tools. I don't use Windows and thus don't know what to install, but at least a C++ compiler and linker is needed.

mohammadtetouan commented 6 years ago

salam ` if there is any other solution instead of installing Visual C++ because it takes alot of disk space Failed building wheel for hiredis Running setup.py clean for hiredis Successfully built msgpack Failed to build hiredis Installing collected packages: hiredis, aioredis, msgpack, channels-redis Running setup.py install for hiredis ... error Complete output from command d:\apps\channels_tut\env\scripts\python.exe -u -c "import setuptools, tokenize;file='C:\Users\mohammad\AppData\Local\Temp\pip-build-6fjjpprm\hiredis\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\mohammad\AppData\Local\Temp\pip-54c9goms-record\install-record.txt --single-version-externally-managed --compile --install-headers d:\apps\channels_tut\env\include\site\python3.6\hiredis: running install running build running build_py creating build creating build\lib.win32-3.6 creating build\lib.win32-3.6\hiredis copying hiredis\version.py -> build\lib.win32-3.6\hiredis copying hiredis__init__.py -> build\lib.win32-3.6\hiredis running build_clib building 'hiredis_for_hiredis_py' library error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools `

ifduyue commented 6 years ago

I'm going to close this. If there's a problem, please open a new issue.