yara-python icon indicating copy to clipboard operation
yara-python copied to clipboard

win10 python2.7.17 cant install yara-python?

Open ablacknut opened this issue 5 years ago • 6 comments

Using legacy setup.py install for yara-python, since package 'wheel' is not installed. Installing collected packages: yara-python Running setup.py install for yara-python ... error ERROR: Command errored out with exit status 1: command: 'd:\programing\pythonstudy\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"' "'c:\users\26111\appdata\local\temp\pip-install-oae45q\yara-python\setup.py'"'"'; file='"'"'c:\users\26111 \appdata\local\temp\pip-install-oae45q\yara-python\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\26111\appdata\local\temp\pip-record-ls0pbn\install-record.txt' --single-version-externally-managed -- compile --install-headers 'd:\programing\pythonstudy\python27\Include\yara-python' cwd: c:\users\26111\appdata\local\temp\pip-install-oae45q\yara-python
Complete output (21 lines): running install running build running build_ext building 'yara' extension creating build creating build\temp.win-amd64-2.7 creating build\temp.win-amd64-2.7\Release creating build\temp.win-amd64-2.7\Release\yara creating build\temp.win-amd64-2.7\Release\yara\libyara creating build\temp.win-amd64-2.7\Release\yara\libyara\modules creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\demo creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\elf creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\math creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\pe creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\tests creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\time creating build\temp.win-amd64-2.7\Release\yara\libyara\proc C:\Users\26111\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DUSE_WINDOWS_PROC=1 -D_CRT_SECURE_NO_WARNINGS=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Id:\p rograming\pythonstudy\python27\include -Id:\programing\pythonstudy\python27\PC /Tcyara-python.c /Fobuild\temp.win-amd64- 2.7\Release\yara-python.obj yara-python.c yara/libyara/include\yara/types.h(33) : fatal error C1083: Cannot open include file: 'stdbool.h': No such file or di rectory error: command 'C:\Users\26111\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\ amd64\cl.exe' failed with exit status 2 ---------------------------------------- ERROR: Command errored out with exit status 1: 'd:\programing\pythonstudy\python27\python.exe' -u -c 'import sys, setupt ools, tokenize; sys.argv[0] = '"'"'c:\users\26111\appdata\local\temp\pip-install-oae45q\yara-python\setup.py'"'" '; file='"'"'c:\users\26111\appdata\local\temp\pip-install-oae45q\yara-python\setup.py'"'"';f=getattr(tokeni ze, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, f ile, '"'"'exec'"'"'))' install --record 'c:\users\26111\appdata\local\temp\pip-record-ls0pbn\install-record.txt' --sin gle-version-externally-managed --compile --install-headers 'd:\programing\pythonstudy\python27\Include\yara-python' Chec k the logs for full command output.


I tried to move the stdbool.h file to the wheel file of yara, it didn't work either and there were other problems

Using legacy setup.py install for yara-python, since package 'wheel' is not installed. Installing collected packages: yara-python Running setup.py install for yara-python ... error ERROR: Command errored out with exit status 1: command: 'd:\programing\pythonstudy\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"' "'c:\users\26111\appdata\local\temp\pip-req-build-uh94lm\setup.py'"'"'; file='"'"'c:\users\26111\appdata\ local\temp\pip-req-build-uh94lm\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().repla ce('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'c:\users\261 11\appdata\local\temp\pip-record-tvb8xq\install-record.txt' --single-version-externally-managed --compile --install-head ers 'd:\programing\pythonstudy\python27\Include\yara-python' cwd: c:\users\26111\appdata\local\temp\pip-req-build-uh94lm
Complete output (126 lines): running install running build running build_ext building 'yara' extension creating build creating build\temp.win-amd64-2.7 creating build\temp.win-amd64-2.7\Release creating build\temp.win-amd64-2.7\Release\yara creating build\temp.win-amd64-2.7\Release\yara\libyara creating build\temp.win-amd64-2.7\Release\yara\libyara\modules creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\demo creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\elf creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\math creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\pe creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\tests creating build\temp.win-amd64-2.7\Release\yara\libyara\modules\time creating build\temp.win-amd64-2.7\Release\yara\libyara\proc C:\Users\26111\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DUSE_WINDOWS_PROC=1 -D_CRT_SECURE_NO_WARNINGS=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Id:\p rograming\pythonstudy\python27\include -Id:\programing\pythonstudy\python27\PC /Tcyara-python.c /Fobuild\temp.win-amd64- 2.7\Release\yara-python.obj yara-python.c C:\Users\26111\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DUSE_WINDOWS_PROC=1 -D_CRT_SECURE_NO_WARNINGS=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Id:\p rograming\pythonstudy\python27\include -Id:\programing\pythonstudy\python27\PC /Tcyara\libyara\ahocorasick.c /Fobuild\te mp.win-amd64-2.7\Release\yara\libyara\ahocorasick.obj ahocorasick.c yara\libyara\ahocorasick.c(219) : error C2059: syntax error : '{' yara\libyara\ahocorasick.c(340) : error C2059: syntax error : '{' yara\libyara\ahocorasick.c(360) : error C2181: illegal else without matching if yara\libyara\ahocorasick.c(376) : error C2059: syntax error : 'return' yara\libyara\ahocorasick.c(377) : error C2059: syntax error : '}' yara\libyara\ahocorasick.c(449) : warning C4013: '_yr_ac_transitions_subset' undefined; assuming extern returning in t yara\libyara\ahocorasick.c(535) : error C2275: 'size_t' : illegal use of this type as an expression yara\libyara\ahocorasick.c : see declaration of 'size_t' yara\libyara\ahocorasick.c(535) : error C2146: syntax error : missing ';' before identifier 'bm_len' yara\libyara\ahocorasick.c(535) : error C2065: 'bm_len' : undeclared identifier yara\libyara\ahocorasick.c(538) : error C2275: 'size_t' : illegal use of this type as an expression yara\libyara\ahocorasick.c : see declaration of 'size_t' yara\libyara\ahocorasick.c(538) : error C2146: syntax error : missing ';' before identifier 'bm_len_incr' yara\libyara\ahocorasick.c(538) : error C2065: 'bm_len_incr' : undeclared identifier yara\libyara\ahocorasick.c(540) : error C2065: 'bm_len' : undeclared identifier yara\libyara\ahocorasick.c(540) : error C2065: 'bm_len_incr' : undeclared identifier yara\libyara\ahocorasick.c(545) : error C2065: 'bm_len' : undeclared identifier yara\libyara\ahocorasick.c(545) : error C2065: 'bm_len_incr' : undeclared identifier yara\libyara\ahocorasick.c(664) : error C2059: syntax error : '{' yara\libyara\ahocorasick.c(713) : error C2059: syntax error : '{' yara\libyara\ahocorasick.c(715) : error C2181: illegal else without matching if yara\libyara\ahocorasick.c(761) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(761) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(761) : error C2143: syntax error : missing ')' before 'type' yara\libyara\ahocorasick.c(761) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(761) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(761) : warning C4552: '<' : operator has no effect; expected operator with side-effect yara\libyara\ahocorasick.c(761) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(761) : error C2059: syntax error : ')' yara\libyara\ahocorasick.c(762) : error C2146: syntax error : missing ';' before identifier 'printf' yara\libyara\ahocorasick.c(782) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(782) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(782) : error C2143: syntax error : missing ')' before 'type' yara\libyara\ahocorasick.c(782) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(782) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(782) : warning C4552: '<' : operator has no effect; expected operator with side-effect yara\libyara\ahocorasick.c(782) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(782) : error C2059: syntax error : ')' yara\libyara\ahocorasick.c(783) : error C2146: syntax error : missing ';' before identifier 'printf' yara\libyara\ahocorasick.c(791) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(791) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(791) : error C2143: syntax error : missing ')' before 'type' yara\libyara\ahocorasick.c(791) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(791) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(791) : warning C4552: '<' : operator has no effect; expected operator with side-effect yara\libyara\ahocorasick.c(791) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(791) : error C2059: syntax error : ')' yara\libyara\ahocorasick.c(792) : error C2146: syntax error : missing ';' before identifier 'printf' yara\libyara\ahocorasick.c(792) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(800) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(800) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(800) : error C2143: syntax error : missing ')' before 'type' yara\libyara\ahocorasick.c(800) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(800) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(800) : warning C4552: '<' : operator has no effect; expected operator with side-effect yara\libyara\ahocorasick.c(800) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(800) : error C2059: syntax error : ')' yara\libyara\ahocorasick.c(801) : error C2146: syntax error : missing ';' before identifier 'printf' yara\libyara\ahocorasick.c(801) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(808) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(808) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(808) : error C2143: syntax error : missing ')' before 'type' yara\libyara\ahocorasick.c(808) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(808) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(808) : warning C4552: '<' : operator has no effect; expected operator with side-effect yara\libyara\ahocorasick.c(808) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(808) : error C2059: syntax error : ')' yara\libyara\ahocorasick.c(809) : error C2146: syntax error : missing ';' before identifier 'printf' yara\libyara\ahocorasick.c(809) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(856) : error C2059: syntax error : '{' yara\libyara\ahocorasick.c(913) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(913) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(913) : error C2143: syntax error : missing ')' before 'type' yara\libyara\ahocorasick.c(913) : error C2143: syntax error : missing ';' before 'type' yara\libyara\ahocorasick.c(913) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(913) : warning C4552: '<' : operator has no effect; expected operator with side-effect yara\libyara\ahocorasick.c(913) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(913) : error C2059: syntax error : ')' yara\libyara\ahocorasick.c(914) : error C2143: syntax error : missing ';' before '{' yara\libyara\ahocorasick.c(915) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(919) : error C2065: 'i' : undeclared identifier yara\libyara\ahocorasick.c(928) : error C2275: 'YR_ARENA_REF' : illegal use of this type as an expression yara/libyara/include\yara/arena.h(52) : see declaration of 'YR_ARENA_REF' yara\libyara\ahocorasick.c(928) : error C2146: syntax error : missing ';' before identifier 'new_match_ref' yara\libyara\ahocorasick.c(928) : error C2065: 'new_match_ref' : undeclared identifier yara\libyara\ahocorasick.c(939) : error C2065: 'new_match_ref' : undeclared identifier yara\libyara\ahocorasick.c(939) : warning C4133: 'function' : incompatible types - from 'int *' to 'YR_ARENA_REF *' yara\libyara\ahocorasick.c(941) : error C2275: 'YR_AC_MATCH' : illegal use of this type as an expression yara/libyara/include\yara/types.h(202) : see declaration of 'YR_AC_MATCH' yara\libyara\ahocorasick.c(941) : error C2065: 'new_match' : undeclared identifier yara\libyara\ahocorasick.c(941) : error C2065: 'new_match_ref' : undeclared identifier yara\libyara\ahocorasick.c(941) : warning C4133: 'function' : incompatible types - from 'int *' to 'YR_ARENA_REF *' yara\libyara\ahocorasick.c(943) : error C2065: 'new_match' : undeclared identifier yara\libyara\ahocorasick.c(943) : error C2223: left of '->backtrack' must point to struct/union yara\libyara\ahocorasick.c(944) : error C2065: 'new_match' : undeclared identifier yara\libyara\ahocorasick.c(944) : error C2223: left of '->string' must point to struct/union yara\libyara\ahocorasick.c(947) : error C2065: 'new_match' : undeclared identifier yara\libyara\ahocorasick.c(947) : error C2223: left of '->forward_code' must point to struct/union yara\libyara\ahocorasick.c(950) : error C2065: 'new_match' : undeclared identifier yara\libyara\ahocorasick.c(950) : error C2223: left of '->backward_code' must point to struct/union yara\libyara\ahocorasick.c(954) : error C2065: 'new_match' : undeclared identifier yara\libyara\ahocorasick.c(954) : error C2223: left of '->next' must point to struct/union yara\libyara\ahocorasick.c(955) : error C2065: 'new_match_ref' : undeclared identifier yara\libyara\ahocorasick.c(955) : error C2440: '=' : cannot convert from 'int' to 'YR_ARENA_REF' error: command 'C:\Users\26111\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\ amd64\cl.exe' failed with exit status 2 ---------------------------------------- ERROR: Command errored out with exit status 1: 'd:\programing\pythonstudy\python27\python.exe' -u -c 'import sys, setupt ools, tokenize; sys.argv[0] = '"'"'c:\users\26111\appdata\local\temp\pip-req-build-uh94lm\setup.py'"'"'; file ='"'"'c:\users\26111\appdata\local\temp\pip-req-build-uh94lm\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\26111\appdata\local\temp\pip-record-tvb8xq\install-record.txt' --single-version-externally -managed --compile --install-headers 'd:\programing\pythonstudy\python27\Include\yara-python' Check the logs for full co mmand output.

ablacknut avatar Jul 01 '20 14:07 ablacknut

I am encountering same error. If you can, try to revert to installing 3.11.0 since that worked for me.

nick-botticelli avatar Jul 09 '20 00:07 nick-botticelli

Hey guys. I'm facing the same problem. I tried to build yara-python on python2.7 and it doesn't work from many problems.

The last error was

python2 setup.py build --dynamic-linking
running build
running build_ext
building 'yara' extension
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DUSE_WINDOWS_PROC=1 -D_CRT_SECURE_NO_WARNINGS=1 -Iyara/libyara/include -Iyara/libyara/ -I. -IC:\Python27\include -IC:\Python27\PC /Tcyara-python.c /Fobuild\temp.win-amd64-2.7\Release\yara-python.obj
yara-python.c
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 /LIBPATH:C:\Python27\PC\VS9.0\amd64 kernel32.lib advapi32.lib user32.lib crypt32.lib ws2_32.lib yara.lib /EXPORT:inityara build\temp.win-amd64-2.7\Release\yara-python.obj /OUT:build\lib.win-amd64-2.7\yara.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\yara.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\yara.pyd.manifest
LINK : fatal error LNK1181: cannot open input file 'yara.lib'
error: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1181

JhonJohnatan avatar Nov 10 '20 14:11 JhonJohnatan

pip install yara-python==3.11.0 It's work for me on Python 2.7

KinJih avatar Mar 09 '21 08:03 KinJih

Hey guys. I'm facing the same problem. I tried to build yara-python on python2.7 and it doesn't work from many problems.

The last error was

You probably need to tell it where to find yara.lib. You should be able to modify LIBPATH to point to where ever your yara.lib is. Looks like the Windows build doesn't work with dynamic linking?

wxsBSD avatar Mar 12 '21 02:03 wxsBSD

pip install yara-python==3.11.0 It's work for me on Python 2.7

thanks it solve my problem, it also work with wine

hhyygg2009 avatar Jan 21 '24 15:01 hhyygg2009

It also solved my problem. Can someone close topic?

pip install yara-python==3.11.0 It's work for me on Python 2.7

HydraDragonAntivirus avatar Feb 04 '24 14:02 HydraDragonAntivirus