"Failed building wheel for py-bcrypt" when pip installing flask-user
Question: I'm trying to pip install the various extensions for Flask. So far they've all
succeeded, and I've had no problems installing flask, flask-bcrypt, etc. with
the exception of flask-user.

When I try to pip install flask-user, the first error I get is "Failed
building wheel for py-bcrypt".

And then the following appears.

    
    
    Failed to build py-bcrypt
    Installing collected packages: py-bcrypt, pycrypto, flask-user
      Running setup.py install for py-bcrypt
        Complete output from command C:\Python27\Scripts\venv_flask\Scripts\python.e
    xe -c "import setuptools, tokenize;__file__='c:\\users\\brandon\\appdata\\local\
    \temp\\pip-build-czloyh\\py-bcrypt\\setup.py';exec(compile(getattr(tokenize, 'op
    en', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install -
    -record c:\users\brandon\appdata\local\temp\pip-nk4rxx-record\install-record.txt
     --single-version-externally-managed --compile --install-headers C:\Python27\Scr
    ipts\venv_flask\include\site\python2.7\py-bcrypt:
        running install
        running build
        running build_py
        running build_ext
        building 'bcrypt._bcrypt' extension
        C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
    on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
    -IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/bcrypt.c /Fobuild\temp.win32-2.7\R
    elease\bcrypt/bcrypt.obj
        bcrypt.c
        bcrypt/bcrypt.c(139) : warning C4996: '_snprintf': This function or variable
     may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
    _CRT_SECURE_NO_WARNINGS. See online help for details.
                C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++
    for Python\9.0\VC\Include\stdio.h(358) : see declaration of '_snprintf'
        bcrypt/bcrypt.c(249) : warning C4996: '_snprintf': This function or variable
     may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
    _CRT_SECURE_NO_WARNINGS. See online help for details.
                C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++
    for Python\9.0\VC\Include\stdio.h(358) : see declaration of '_snprintf'
        C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
    on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
    -IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/bcrypt_pbkdf.c /Fobuild\temp.win32
    -2.7\Release\bcrypt/bcrypt_pbkdf.obj
        bcrypt_pbkdf.c
        C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
    on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
    -IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/bcrypt_python.c /Fobuild\temp.win3
    2-2.7\Release\bcrypt/bcrypt_python.obj
        bcrypt_python.c
        bcrypt/bcrypt_python.c(63) : warning C4244: 'function' : conversion from 'lo
    ng' to 'u_int8_t', possible loss of data
        C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
    on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
    -IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/blowfish.c /Fobuild\temp.win32-2.7
    \Release\bcrypt/blowfish.obj
        blowfish.c
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(86) : error C2146: syntax error : missing ')' before identifier 'passlen'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(86) : error C2081: 'size_t' : name in formal parameter list illegal
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(86) : error C2061: syntax error : identifier 'passlen'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(86) : error C2059: syntax error : ';'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(86) : error C2059: syntax error : ','
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(88) : error C2059: syntax error : ')'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(91) : error C2146: syntax error : missing ')' before identifier 'n'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(91) : error C2081: 'size_t' : name in formal parameter list illegal
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(91) : error C2061: syntax error : identifier 'n'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(91) : error C2059: syntax error : ';'
        c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
    lf.h(91) : error C2059: syntax error : ')'
        error: command 'C:\\Users\\Brandon\\AppData\\Local\\Programs\\Common\\Micros
    oft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
    

I didn't want to risk leaving anything out. However, I BELIEVE the key part of
this error message is this part:

    
    
        bcrypt/bcrypt.c(139) : warning C4996: '_snprintf': This function or variable
     may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
    _CRT_SECURE_NO_WARNINGS. See online help for details.
    

I believe that there is something with Microsoft Visual Basic that's the
problem. However, I haven't gotten any good answers online when I looked it
up. I'm using Microsoft Visual Basic C++ 's compiler for Python 2.7

I haven't seen any other problems online that seem to address my problem. Some
come close, but they seem to offer solutions that don't have anything to do
with my problem (references to files that I don't use/have, etc.)


Answer: This was an issue with Microsoft Visual Studio which seems to be patched now.
See [here](https://code.google.com/p/py-bcrypt/issues/detail?id=15) the patch.

