VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
648 stars 179 forks source link

Got an error in Windows 10 #146

Closed 490694561 closed 4 years ago

490694561 commented 4 years ago
E:\Cheat
λ pip install yara-python
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting yara-python
  Downloading http://mirrors.aliyun.com/pypi/packages/c6/a3/f21aeebe85bbe3f2e089324663ea206fa1fc3f4196815b30b752f2e93e67/yara-python-4.0.1.tar.gz (405 kB)
     |████████████████████████████████| 405 kB 541 kB/s
Building wheels for collected packages: yara-python
  Building wheel for yara-python (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'e:\program files\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\0xpoker\\appdata\\local\\temp\\pip-install-vboyd0\\yara-python\\setup.py'"'"'; __file__='"'"'c:\\users\\0xpoker\\appdata\\local\\temp\\pip-install-vboyd0\\yara-python\\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\0xpoker\appdata\local\temp\pip-wheel-lflz66'
       cwd: c:\users\0xpoker\appdata\local\temp\pip-install-vboyd0\yara-python\
  Complete output (66 lines):
  running bdist_wheel
  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\0xpoker\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. "-Ie:\program files\python27\include" "-Ie:\program files\python27\PC" /Tcyara-python.c /Fobuild\temp.win-amd64-2.7\Release\yara-python.obj
  yara-python.c
  yara/libyara/include\yara/stream.h(35) : error C2054: expected '(' to follow '_Bool'
  yara/libyara/include\yara/stream.h(35) : error C2143: syntax error : missing ';' before 'type'
  yara/libyara/include\yara/stream.h(39) : error C2085: 'YR_STREAM_READ_FUNC' : not in formal parameter list
  yara/libyara/include\yara/stream.h(46) : error C2085: 'YR_STREAM_WRITE_FUNC' : not in formal parameter list
  yara/libyara/include\yara/stream.h(53) : error C2061: syntax error : identifier 'YR_STREAM_READ_FUNC'
  yara/libyara/include\yara/stream.h(54) : error C2061: syntax error : identifier 'write'
  yara/libyara/include\yara/stream.h(54) : error C2059: syntax error : ';'
  yara/libyara/include\yara/stream.h(56) : error C2059: syntax error : '}'
  yara/libyara/include\yara/stream.h(63) : error C2143: syntax error : missing ')' before '*'
  yara/libyara/include\yara/stream.h(63) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
  yara/libyara/include\yara/stream.h(63) : error C2143: syntax error : missing '{' before '*'
  yara/libyara/include\yara/stream.h(63) : error C2059: syntax error : ')'
  yara/libyara/include\yara/stream.h(70) : error C2143: syntax error : missing ')' before '*'
  yara/libyara/include\yara/stream.h(70) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
  yara/libyara/include\yara/stream.h(70) : error C2143: syntax error : missing '{' before '*'
  yara/libyara/include\yara/stream.h(70) : error C2059: syntax error : ')'
  yara/libyara/include\yara/arena.h(272) : error C2143: syntax error : missing ')' before '*'
  yara/libyara/include\yara/arena.h(272) : error C2143: syntax error : missing '{' before '*'
  yara/libyara/include\yara/arena.h(273) : error C2371: 'YR_ARENA' : redefinition; different basic types
          yara/libyara/include\yara/arena.h(50) : see declaration of 'YR_ARENA'
  yara/libyara/include\yara/arena.h(273) : error C2143: syntax error : missing ';' before '*'
  yara/libyara/include\yara/arena.h(273) : error C2059: syntax error : ')'
  yara/libyara/include\yara/arena.h(278) : error C2143: syntax error : missing ')' before '*'
  yara/libyara/include\yara/arena.h(278) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
  yara/libyara/include\yara/arena.h(278) : error C2143: syntax error : missing '{' before '*'
  yara/libyara/include\yara/arena.h(278) : error C2059: syntax error : ')'
  yara/libyara/include\yara/rules.h(133) : error C2143: syntax error : missing ')' before '*'
  yara/libyara/include\yara/rules.h(133) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
  yara/libyara/include\yara/rules.h(133) : error C2143: syntax error : missing '{' before '*'
  yara/libyara/include\yara/rules.h(133) : error C2059: syntax error : ')'
  yara/libyara/include\yara/rules.h(142) : error C2143: syntax error : missing ')' before '*'
  yara/libyara/include\yara/rules.h(142) : error C2143: syntax error : missing '{' before '*'
  yara/libyara/include\yara/rules.h(143) : error C2371: 'YR_RULES' : redefinition; different basic types
          yara/libyara/include\yara/types.h(209) : see declaration of 'YR_RULES'
  yara/libyara/include\yara/rules.h(143) : error C2143: syntax error : missing ';' before '*'
  yara/libyara/include\yara/rules.h(143) : error C2059: syntax error : ')'
  yara-python.c(1612) : error C2065: 'YR_STREAM' : undeclared identifier
  yara-python.c(1612) : error C2146: syntax error : missing ';' before identifier 'stream'
  yara-python.c(1614) : error C2224: left of '.user_data' must have struct/union type
  yara-python.c(1615) : error C2224: left of '.write' must have struct/union type
  yara-python.c(1618) : warning C4013: 'yr_rules_save_stream' undefined; assuming extern returning int
  yara-python.c(2254) : error C2065: 'YR_STREAM' : undeclared identifier
  yara-python.c(2254) : error C2146: syntax error : missing ';' before identifier 'stream'
  yara-python.c(2256) : error C2224: left of '.user_data' must have struct/union type
  yara-python.c(2257) : error C2224: left of '.read' must have struct/union type
  yara-python.c(2265) : warning C4013: 'yr_rules_load_stream' undefined; assuming extern returning int
  error: command 'C:\\Users\\0xpoker\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for yara-python
  Running setup.py clean for yara-python
Failed to build yara-python
Installing collected packages: yara-python
    Running setup.py install for yara-python ... error
    ERROR: Command errored out with exit status 1:
     command: 'e:\program files\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\0xpoker\\appdata\\local\\temp\\pip-install-vboyd0\\yara-python\\setup.py'"'"'; __file__='"'"'c:\\users\\0xpoker\\appdata\\local\\temp\\pip-install-vboyd0\\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\0xpoker\appdata\local\temp\pip-record-el2lci\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\program files\python27\Include\yara-python'
         cwd: c:\users\0xpoker\appdata\local\temp\pip-install-vboyd0\yara-python\
    Complete output (66 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\0xpoker\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. "-Ie:\program files\python27\include" "-Ie:\program files\python27\PC" /Tcyara-python.c /Fobuild\temp.win-amd64-2.7\Release\yara-python.obj
    yara-python.c
    yara/libyara/include\yara/stream.h(35) : error C2054: expected '(' to follow '_Bool'
    yara/libyara/include\yara/stream.h(35) : error C2143: syntax error : missing ';' before 'type'
    yara/libyara/include\yara/stream.h(39) : error C2085: 'YR_STREAM_READ_FUNC' : not in formal parameter list
    yara/libyara/include\yara/stream.h(46) : error C2085: 'YR_STREAM_WRITE_FUNC' : not in formal parameter list
    yara/libyara/include\yara/stream.h(53) : error C2061: syntax error : identifier 'YR_STREAM_READ_FUNC'
    yara/libyara/include\yara/stream.h(54) : error C2061: syntax error : identifier 'write'
    yara/libyara/include\yara/stream.h(54) : error C2059: syntax error : ';'
    yara/libyara/include\yara/stream.h(56) : error C2059: syntax error : '}'
    yara/libyara/include\yara/stream.h(63) : error C2143: syntax error : missing ')' before '*'
    yara/libyara/include\yara/stream.h(63) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
    yara/libyara/include\yara/stream.h(63) : error C2143: syntax error : missing '{' before '*'
    yara/libyara/include\yara/stream.h(63) : error C2059: syntax error : ')'
    yara/libyara/include\yara/stream.h(70) : error C2143: syntax error : missing ')' before '*'
    yara/libyara/include\yara/stream.h(70) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
    yara/libyara/include\yara/stream.h(70) : error C2143: syntax error : missing '{' before '*'
    yara/libyara/include\yara/stream.h(70) : error C2059: syntax error : ')'
    yara/libyara/include\yara/arena.h(272) : error C2143: syntax error : missing ')' before '*'
    yara/libyara/include\yara/arena.h(272) : error C2143: syntax error : missing '{' before '*'
    yara/libyara/include\yara/arena.h(273) : error C2371: 'YR_ARENA' : redefinition; different basic types
            yara/libyara/include\yara/arena.h(50) : see declaration of 'YR_ARENA'
    yara/libyara/include\yara/arena.h(273) : error C2143: syntax error : missing ';' before '*'
    yara/libyara/include\yara/arena.h(273) : error C2059: syntax error : ')'
    yara/libyara/include\yara/arena.h(278) : error C2143: syntax error : missing ')' before '*'
    yara/libyara/include\yara/arena.h(278) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
    yara/libyara/include\yara/arena.h(278) : error C2143: syntax error : missing '{' before '*'
    yara/libyara/include\yara/arena.h(278) : error C2059: syntax error : ')'
    yara/libyara/include\yara/rules.h(133) : error C2143: syntax error : missing ')' before '*'
    yara/libyara/include\yara/rules.h(133) : error C2081: 'YR_STREAM' : name in formal parameter list illegal
    yara/libyara/include\yara/rules.h(133) : error C2143: syntax error : missing '{' before '*'
    yara/libyara/include\yara/rules.h(133) : error C2059: syntax error : ')'
    yara/libyara/include\yara/rules.h(142) : error C2143: syntax error : missing ')' before '*'
    yara/libyara/include\yara/rules.h(142) : error C2143: syntax error : missing '{' before '*'
    yara/libyara/include\yara/rules.h(143) : error C2371: 'YR_RULES' : redefinition; different basic types
            yara/libyara/include\yara/types.h(209) : see declaration of 'YR_RULES'
    yara/libyara/include\yara/rules.h(143) : error C2143: syntax error : missing ';' before '*'
    yara/libyara/include\yara/rules.h(143) : error C2059: syntax error : ')'
    yara-python.c(1612) : error C2065: 'YR_STREAM' : undeclared identifier
    yara-python.c(1612) : error C2146: syntax error : missing ';' before identifier 'stream'
    yara-python.c(1614) : error C2224: left of '.user_data' must have struct/union type
    yara-python.c(1615) : error C2224: left of '.write' must have struct/union type
    yara-python.c(1618) : warning C4013: 'yr_rules_save_stream' undefined; assuming extern returning int
    yara-python.c(2254) : error C2065: 'YR_STREAM' : undeclared identifier
    yara-python.c(2254) : error C2146: syntax error : missing ';' before identifier 'stream'
    yara-python.c(2256) : error C2224: left of '.user_data' must have struct/union type
    yara-python.c(2257) : error C2224: left of '.read' must have struct/union type
    yara-python.c(2265) : warning C4013: 'yr_rules_load_stream' undefined; assuming extern returning int
    error: command 'C:\\Users\\0xpoker\\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: 'e:\program files\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\0xpoker\\appdata\\local\\temp\\pip-install-vboyd0\\yara-python\\setup.py'"'"'; __file__='"'"'c:\\users\\0xpoker\\appdata\\local\\temp\\pip-install-vboyd0\\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\0xpoker\appdata\local\temp\pip-record-el2lci\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\program files\python27\Include\yara-python' Check the logs for full command output.

I cannot find how to fix it.

BlackOfWorld commented 4 years ago

Same issue, any fix yet?

plusvic commented 4 years ago

Starting with v4.0 YARA won't support Python 2.x anymore. Windows installers for Python 2.x are not generated anymore because Visual C++ 9.0 doesn't support C99. The source code has started using C99 features and won't compile with such an old compiler.