Error when pip installing CRFsuite in Python 3 Windows 10 x86
Question: I'm trying to install [CRFsuite](https://python-
crfsuite.readthedocs.io/en/latest/) to my Python 3 based on Windows 10 x86
while an Error occured, please see below. At start, it was missing
`vcvars32.bat` but I managed to solve it by installing _Microsoft Visual
Studio 2015_ including _Common tools for visual c++ 2015_. After that, it
starts to run but this came out: `error: command 'C:\\Program Files
(x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit
status 2`.

The problem seems to be defining the `snprintf` in `stdio.h`, I have tried
solution provided
[here](http://stackoverflow.com/questions/27754492/vs-2015-compiling-
cocos2d-x-3-3-error-fatal-error-c1189-error-macro-definiti) by adding a few
lines of code in `stdio.h` but not working.

    
    
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error:  Macro definition of snprintf conflicts with Standard Library function declaration
    

Please see more details below. Kindly hope anyone would give me a hand. Thanks
in advance.

    
    
    [Python3] C:\>cd "Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin"
    
    [Python3] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>VCVARS32
    [Python3] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>pip install python-crfsuite
    Collecting python-crfsuite
      Using cached python-crfsuite-0.8.4.tar.gz
    Building wheels for collected packages: python-crfsuite
      Running setup.py bdist_wheel for python-crfsuite ... error
      Complete output from command f:\python3\anaconda3\envs\python3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-dwkmw7ii\\python-crfsuite\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\ADMINI~1\AppData\Local\Temp\tmph_uhnrfipip-wheel- --python-tag cp35:
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.5
      creating build\lib.win-amd64-3.5\pycrfsuite
      copying pycrfsuite\_dumpparser.py -> build\lib.win-amd64-3.5\pycrfsuite
      copying pycrfsuite\_logparser.py -> build\lib.win-amd64-3.5\pycrfsuite
      copying pycrfsuite\__init__.py -> build\lib.win-amd64-3.5\pycrfsuite
      running build_ext
      building 'pycrfsuite._pycrfsuite' extension
      creating build\temp.win-amd64-3.5
      creating build\temp.win-amd64-3.5\Release
      creating build\temp.win-amd64-3.5\Release\pycrfsuite
      creating build\temp.win-amd64-3.5\Release\crfsuite
      creating build\temp.win-amd64-3.5\Release\crfsuite\lib
      creating build\temp.win-amd64-3.5\Release\crfsuite\lib\crf
      creating build\temp.win-amd64-3.5\Release\crfsuite\lib\crf\src
      creating build\temp.win-amd64-3.5\Release\crfsuite\swig
      creating build\temp.win-amd64-3.5\Release\crfsuite\lib\cqdb
      creating build\temp.win-amd64-3.5\Release\crfsuite\lib\cqdb\src
      creating build\temp.win-amd64-3.5\Release\liblbfgs
      creating build\temp.win-amd64-3.5\Release\liblbfgs\lib
      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -If:\python3\anaconda3\envs\python3\include -If:\python3\anaconda3\envs\python3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tppycrfsuite/_pycrfsuite.cpp /Fobuild\temp.win-amd64-3.5\Release\pycrfsuite/_pycrfsuite.obj
      _pycrfsuite.cpp
      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -If:\python3\anaconda3\envs\python3\include -If:\python3\anaconda3\envs\python3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tppycrfsuite/trainer_wrapper.cpp /Fobuild\temp.win-amd64-3.5\Release\pycrfsuite/trainer_wrapper.obj
      trainer_wrapper.cpp
      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -If:\python3\anaconda3\envs\python3\include -If:\python3\anaconda3\envs\python3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tccrfsuite/lib/crf/src\crf1d_context.c /Fobuild\temp.win-amd64-3.5\Release\crfsuite/lib/crf/src\crf1d_context.obj
      crf1d_context.c
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\math.h(262): warning C4005: 'isfinite': macro redefinition
      crfsuite/include/os.h(49): note: see previous definition of 'isfinite'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1925): warning C4005: 'snprintf': macro redefinition
      crfsuite/include/os.h(50): note: see previous definition of 'snprintf'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error:  Macro definition of snprintf conflicts with Standard Library function declaration
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
    
      ----------------------------------------
      Failed building wheel for python-crfsuite
      Running setup.py clean for python-crfsuite
    Failed to build python-crfsuite
    Installing collected packages: python-crfsuite
      Running setup.py install for python-crfsuite ... error
        Complete output from command f:\python3\anaconda3\envs\python3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-dwkmw7ii\\python-crfsuite\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-sd7k3msy-record\install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-3.5
        creating build\lib.win-amd64-3.5\pycrfsuite
        copying pycrfsuite\_dumpparser.py -> build\lib.win-amd64-3.5\pycrfsuite
        copying pycrfsuite\_logparser.py -> build\lib.win-amd64-3.5\pycrfsuite
        copying pycrfsuite\__init__.py -> build\lib.win-amd64-3.5\pycrfsuite
        running build_ext
        building 'pycrfsuite._pycrfsuite' extension
        creating build\temp.win-amd64-3.5
        creating build\temp.win-amd64-3.5\Release
        creating build\temp.win-amd64-3.5\Release\pycrfsuite
        creating build\temp.win-amd64-3.5\Release\crfsuite
        creating build\temp.win-amd64-3.5\Release\crfsuite\lib
        creating build\temp.win-amd64-3.5\Release\crfsuite\lib\crf
        creating build\temp.win-amd64-3.5\Release\crfsuite\lib\crf\src
        creating build\temp.win-amd64-3.5\Release\crfsuite\swig
        creating build\temp.win-amd64-3.5\Release\crfsuite\lib\cqdb
        creating build\temp.win-amd64-3.5\Release\crfsuite\lib\cqdb\src
        creating build\temp.win-amd64-3.5\Release\liblbfgs
        creating build\temp.win-amd64-3.5\Release\liblbfgs\lib
        C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -If:\python3\anaconda3\envs\python3\include -If:\python3\anaconda3\envs\python3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tppycrfsuite/_pycrfsuite.cpp /Fobuild\temp.win-amd64-3.5\Release\pycrfsuite/_pycrfsuite.obj
        _pycrfsuite.cpp
        C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -If:\python3\anaconda3\envs\python3\include -If:\python3\anaconda3\envs\python3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tppycrfsuite/trainer_wrapper.cpp /Fobuild\temp.win-amd64-3.5\Release\pycrfsuite/trainer_wrapper.obj
        trainer_wrapper.cpp
        C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -If:\python3\anaconda3\envs\python3\include -If:\python3\anaconda3\envs\python3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tccrfsuite/lib/crf/src\crf1d_context.c /Fobuild\temp.win-amd64-3.5\Release\crfsuite/lib/crf/src\crf1d_context.obj
        crf1d_context.c
        C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\math.h(262): warning C4005: 'isfinite': macro redefinition
        crfsuite/include/os.h(49): note: see previous definition of 'isfinite'
        C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1925): warning C4005: 'snprintf': macro redefinition
        crfsuite/include/os.h(50): note: see previous definition of 'snprintf'
        C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error:  Macro definition of snprintf conflicts with Standard Library function declaration
        error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
    
        ----------------------------------------
    Command "f:\python3\anaconda3\envs\python3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-dwkmw7ii\\python-crfsuite\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-sd7k3msy-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-dwkmw7ii\python-crfsuite\
    
    [Python3] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>
    


Answer: See this post regarding precisely why the compilation fails. [VS 2015
compiling cocos2d-x 3.3 error "fatal error C1189: #error: Macro definition of
snprintf conflicts with Standard Library function
declaration"](http://stackoverflow.com/questions/27754492/vs-2015-compiling-
cocos2d-x-3-3-error-fatal-error-c1189-error-macro-definiti/27754829#27754829)

WRT quick fixes - we were able to get a successful build on Python 3.4, so
perhaps consider using that if this isn't a major project?

