mongodb-labs / python-bsonjs

A fast BSON to MongoDB Extended JSON converter for Python - This Repository is NOT a supported MongoDB product
Apache License 2.0
40 stars 10 forks source link

Build fails with Python 3.8.5 on Windows 10 #17

Closed brmmm3 closed 3 years ago

brmmm3 commented 4 years ago
Failed to build python-bsonjs
DEPRECATION: Could not build wheels for python-bsonjs which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: python-bsonjs
    Running setup.py install for python-bsonjs ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\toolusagelogger\_env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bam5wi\\AppData\\Local\\Temp\\pip-install-dutuekdi\\python-bsonjs\\setup.py'"'"'; __file__='"'"'C:\\Users\\bam5wi\\AppData\\Local\\Temp\\pip-install-dutuekdi\\python-bsonjs\\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\bam5wi\AppData\Local\Temp\pip-record-dbaa8bjo\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\toolusagelogger\_env\include\site\python3.8\python-bsonjs'
         cwd: C:\Users\bam5wi\AppData\Local\Temp\pip-install-dutuekdi\python-bsonjs\
    Complete output (75 lines):
    running install
    running build
    running build_ext
    building 'bsonjs' extension
    creating build
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    creating build\temp.win-amd64-3.8\Release\libbson
    creating build\temp.win-amd64-3.8\Release\libbson\src
    creating build\temp.win-amd64-3.8\Release\libbson\src\bson
    creating build\temp.win-amd64-3.8\Release\libbson\src\jsonsl
    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\Bin\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DBSON_COMPILATION=1 -Isrc -Isrc/bson -Ilibbson/src -Ilibbson/src/jsonsl -Ilibbson/src/bson -Ic:\python\toolusagelogger\_env\include -IC:\Python\_envs\Python38\include -IC:\Python\_envs\Python38\include "-IC:\Program Files\Microsoft SDKs\Windows\v7.1\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" -IC:\Python\ToolUsageLogger\_env\Include -IC:\Python\ToolUsageLogger\_env\Include\cairo "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt" /Tcsrc/bsonjs.c /Fobuild\temp.win-amd64-3.8\Release\src/bsonjs.obj
    bsonjs.c
    c:\python\_envs\python38\include\object.h(436) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\object.h(437) : error C2085: '_Py_NewReference' : not in formal parameter list
    c:\python\_envs\python38\include\object.h(437) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\object.h(446) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\object.h(447) : error C2085: '_Py_ForgetReference' : not in formal parameter list
    c:\python\_envs\python38\include\object.h(447) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\object.h(456) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\object.h(457) : error C2085: '_Py_INCREF' : not in formal parameter list
    c:\python\_envs\python38\include\object.h(457) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\object.h(464) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\object.h(466) : error C2085: '_Py_DECREF' : not in formal parameter list
    c:\python\_envs\python38\include\object.h(466) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\object.h(529) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\object.h(530) : error C2085: '_Py_XINCREF' : not in formal parameter list
    c:\python\_envs\python38\include\object.h(530) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\object.h(538) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\object.h(539) : error C2085: '_Py_XDECREF' : not in formal parameter list
    c:\python\_envs\python38\include\object.h(539) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\cpython/object.h(339) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\cpython/object.h(340) : error C2085: '_Py_Dealloc_inline' : not in formal parameter list
    c:\python\_envs\python38\include\cpython/object.h(340) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\objimpl.h(136) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\objimpl.h(138) : error C2085: '_PyObject_INIT' : not in formal parameter list
    c:\python\_envs\python38\include\objimpl.h(138) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\objimpl.h(151) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\objimpl.h(153) : error C2085: '_PyObject_INIT_VAR' : not in formal parameter list
    c:\python\_envs\python38\include\objimpl.h(153) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\cpython/abstract.h(75) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\cpython/abstract.h(76) : error C2085: 'PyVectorcall_NARGS' : not in formal parameter list
    c:\python\_envs\python38\include\cpython/abstract.h(76) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\cpython/abstract.h(81) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\cpython/abstract.h(82) : error C2085: '_PyVectorcall_Function' : not in formal parameter list
    c:\python\_envs\python38\include\cpython/abstract.h(82) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\cpython/abstract.h(114) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\cpython/abstract.h(117) : error C2085: '_PyObject_Vectorcall' : not in formal parameter list
    c:\python\_envs\python38\include\cpython/abstract.h(117) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\cpython/abstract.h(144) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\cpython/abstract.h(146) : error C2085: '_PyObject_FastCall' : not in formal parameter list
    c:\python\_envs\python38\include\cpython/abstract.h(146) : error C2143: syntax error : missing ';' before '{'
    c:\python\_envs\python38\include\cpython/abstract.h(151) : error C2054: expected '(' to follow 'inline'
    c:\python\_envs\python38\include\cpython/abstract.h(152) : error C2085: '_PyObject_CallNoArg' : not in formal parameter list
    c:\python\_envs\python38\include\cpython/abstract.h(152) : error C2143: syntax error : missing ';' before '{'
    c:\program files\microsoft sdks\windows\v7.1\include\sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\sal.h(2886) : see previous definition of '__useHeader'
    c:\program files\microsoft sdks\windows\v7.1\include\specstrings_supp.h(77) : warning C4005: '__on_failure' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\sal.h(2896) : see previous definition of '__on_failure'
    c:\users\bam5wi\appdata\local\temp\pip-install-dutuekdi\python-bsonjs\libbson\src\bson\bson-compat.h(110) : warning C4005: 'PRIi32' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\inttypes.h(78) : see previous definition of 'PRIi32'
    c:\users\bam5wi\appdata\local\temp\pip-install-dutuekdi\python-bsonjs\libbson\src\bson\bson-compat.h(111) : warning C4005: 'PRId32' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\inttypes.h(68) : see previous definition of 'PRId32'
    c:\users\bam5wi\appdata\local\temp\pip-install-dutuekdi\python-bsonjs\libbson\src\bson\bson-compat.h(112) : warning C4005: 'PRIu32' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\inttypes.h(98) : see previous definition of 'PRIu32'
    c:\users\bam5wi\appdata\local\temp\pip-install-dutuekdi\python-bsonjs\libbson\src\bson\bson-compat.h(113) : warning C4005: 'PRIi64' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\inttypes.h(132) : see previous definition of 'PRIi64'
    c:\users\bam5wi\appdata\local\temp\pip-install-dutuekdi\python-bsonjs\libbson\src\bson\bson-compat.h(114) : warning C4005: 'PRId64' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\inttypes.h(126) : see previous definition of 'PRId64'
    c:\users\bam5wi\appdata\local\temp\pip-install-dutuekdi\python-bsonjs\libbson\src\bson\bson-compat.h(115) : warning C4005: 'PRIu64' : macro redefinition
            C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\inttypes.h(144) : see previous definition of 'PRIu64'
    src/bsonjs.c(102) : warning C4013: '_Py_DECREF' undefined; assuming extern returning int
    src/bsonjs.c(107) : warning C4013: '_Py_INCREF' undefined; assuming extern returning int
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\Bin\\x86_amd64\\cl.exe' failed with exit status 2
behackett commented 4 years ago

I think the issue here is the version of Visual Studio you're trying to build with. Python 3.5+ requires Visual Studio 2015 or better to build C extensions. Quoting https://docs.python.org/3/whatsnew/3.5.html#build-and-c-api-changes

Windows builds now require Microsoft Visual C++ 14.0, which is available as part of Visual Studio 2015.