Error while building cx_freeze with pip wheels - python

I tried to install cx_freeze on win11 and python 3.11.0 but got this error :
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181
I search on stack overflow but no solution with cx_freeze or that "link.exe"
I've installed VS Build Tools with these components :
VS Build Tools modules
My PATH :
The Path variable list
The complete log :
console.c
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(170): warning C4996: 'Py_SetProgramName': deprecated in 3.11
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(171): warning C4996: 'Py_SetPath': deprecated in 3.11
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(173): warning C4996: 'PySys_SetArgvEx': deprecated in 3.11
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1 "/LIBPATH:C:\Program Files\Python311\libs" "/LIBPATH:C:\Program Files\Python311" "/LIBPATH:C:\Program Files\Python311\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" build\temp.win-amd64-cpython-311\Release\source/bases/console.obj /OUT:build\lib.win-amd64-cpython-311\cx_Freeze\bases\console-cp311-win_amd64.exe /MANIFEST
G‚n‚ration de code en cours
Fin de la g‚n‚ration du code
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Python311\include" "-IC:\Program Files\Python311\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsource/bases/Win32GUI.c /Fobuild\temp.win-amd64-cpython-311\Release\source/bases/Win32GUI.obj
Win32GUI.c
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(170): warning C4996: 'Py_SetProgramName': deprecated in 3.11
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(171): warning C4996: 'Py_SetPath': deprecated in 3.11
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(173): warning C4996: 'PySys_SetArgvEx': deprecated in 3.11
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1 "/LIBPATH:C:\Program Files\Python311\libs" "/LIBPATH:C:\Program Files\Python311" "/LIBPATH:C:\Program Files\Python311\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" user32.lib build\temp.win-amd64-cpython-311\Release\source/bases/Win32GUI.obj /OUT:build\lib.win-amd64-cpython-311\cx_Freeze\bases\Win32GUI-cp311-win_amd64.exe /MANIFEST
G‚n‚ration de code en cours
Fin de la g‚n‚ration du code
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Isource/bases "-IC:\Program Files\Python311\include" "-IC:\Program Files\Python311\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcsource/bases/Win32Service.c /Fobuild\temp.win-amd64-cpython-311\Release\source/bases/Win32Service.obj
Win32Service.c
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(170): warning C4996: 'Py_SetProgramName': deprecated in 3.11
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(171): warning C4996: 'Py_SetPath': deprecated in 3.11
C:\Users\PC\AppData\Local\Temp\pip-install-kzzp9ljy\cx-freeze_b4000833d7e0415e9d2c0c894133bc4a\source\bases\common.c(173): warning C4996: 'PySys_SetArgvEx': deprecated in 3.11
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1 "/LIBPATH:C:\Program Files\Python311\libs" "/LIBPATH:C:\Program Files\Python311" "/LIBPATH:C:\Program Files\Python311\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" advapi32.lib cx_Logging.lib delayimp.lib build\temp.win-amd64-cpython-311\Release\source/bases/Win32Service.obj /OUT:build\lib.win-amd64-cpython-311\cx_Freeze\bases\Win32Service-cp311-win_amd64.exe /DELAYLOAD:cx_Logging.cp311-win_amd64.pyd /MANIFEST
LINK : fatal error LNK1181: impossible d'ouvrir le fichier en entr‚e 'cx_Logging.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cx_freeze
Failed to build cx_freeze
ERROR: Could not build wheels for cx_freeze, which is required to install pyproject.toml-based projects
I tried Auto Fixing build tools, reinstalling pip, add sdk to path and I installed all the modules even if they are useless.

I don't have much experience with python but had to run some setup for rebuilding a tool we wrote in python and encountered the same issue.
This setup was also relying on cx_Freeze. I think there is a bug possibly in newer version of MSVC or cx_Freeze itself - no idea.
I worked around by installing this package individually directly from the source, running:
pip install --upgrade git+https://github.com/anthony-tuininga/cx_Freeze.git#main
I re-run the setup afterwards and it worked. The downside is that in the future I would need to manually upgrade this package rather than relying on it being restored auto-magically during rebuilding but at least it's fixed now for me.
Good luck, hope it works for you too.
Edit: This is a known issue, there is an open bug you can subscribe to follow progress updates:
https://github.com/marcelotduarte/cx_Freeze/issues/1662

To install the latest development build [1] compatible with Python 3.11:
pip install --upgrade --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze
[1] https://github.com/marcelotduarte/cx_Freeze#installation

Related

Why they have different MSVC compiler when using different python version to build package with Cython?

I try to build the wheel package with Cython in my project.
My command:
python setup.py bdist_wheel
It could build success with Python3.6, but fail with Python3.7 and Python3.8.
They have the same os environment variables and they have installed the same package dependency.
By comparing two kinds of output, I found that they use different msvc compiler.
Python3.6 works with msvc2019, the full compile command of Cython:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Python36_64\include -IC:\Python36_64\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcbuild\myproject/myservice_obj.c /Fobuild\temp.win-amd64-3.6\Release\build\myproject/myservice_obj.obj
Python3.7 and Python3.8 work with msvc2014, the full compile command of Cython:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Python37_64\include -IC:\Python37_64\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.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" /Tcbuild\myproject/myservice_obj.c /Fobuild\temp.win-amd64-3.7\Release\build\myproject/myservice_obj.obj
Questions:
Why they have different setting of building process?
How to use msvc2019 to build package with python3.7?

How can I build a C++ program in python?

I am using Anaconda. I want to build a source code from github:
https://github.com/mmolero/pypoisson
When I use the following command in the terminal, it gives the following error:
Command: python setup.py build
Error:
running build running build_ext skipping 'src\pypoisson.cpp' Cython
extension (up-to-date) building 'pypoisson' extension C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Ibrahim
Khalilullah.conda\envs\PypoissonOpen3d\lib\site-packages\numpy\core\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program
Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc
/Tpsrc\pypoisson.cpp
/Fobuild\temp.win-amd64-3.6\Release\src\pypoisson.obj -w -fopenmp cl :
Command line warning D9025 : overriding '/W3' with '/w' cl : Command
line warning D9002 : ignoring unknown option '-fopenmp' pypoisson.cpp
c:\users\ibrahim
khalilullah.conda\envs\pypoissonopen3d\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14)
: Warning Msg: Using deprecated NumPy API, disable it with #define
NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Ibrahim
Khalilullah.conda\envs\PypoissonOpen3d\lib\site-packages\numpy\core\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program
Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc
/Tpsrc/PoissonRecon_v6_13/src/CmdLineParser.cpp
/Fobuild\temp.win-amd64-3.6\Release\src/PoissonRecon_v6_13/src/CmdLineParser.obj
-w -fopenmp cl : Command line warning D9025 : overriding '/W3' with '/w' cl : Command line warning D9002 : ignoring unknown option
'-fopenmp' CmdLineParser.cpp C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Ibrahim
Khalilullah.conda\envs\PypoissonOpen3d\lib\site-packages\numpy\core\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program
Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc
/Tpsrc/PoissonRecon_v6_13/src/Factor.cpp
/Fobuild\temp.win-amd64-3.6\Release\src/PoissonRecon_v6_13/src/Factor.obj
-w -fopenmp cl : Command line warning D9025 : overriding '/W3' with '/w' cl : Command line warning D9002 : ignoring unknown option
'-fopenmp' Factor.cpp C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Ibrahim
Khalilullah.conda\envs\PypoissonOpen3d\lib\site-packages\numpy\core\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Users\Ibrahim Khalilullah.conda\envs\PypoissonOpen3d\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program
Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc
/Tpsrc/PoissonRecon_v6_13/src/Geometry.cpp
/Fobuild\temp.win-amd64-3.6\Release\src/PoissonRecon_v6_13/src/Geometry.obj
-w -fopenmp cl : Command line warning D9025 : overriding '/W3' with '/w' cl : Command line warning D9002 : ignoring unknown option
'-fopenmp' Geometry.cpp
d:\feasibilityanalysis2020_3\3dpointcloud3dvision\removenoiseandtin\code\pypoisson\src\poissonrecon_v6_13\src\Geometry.h(33):
fatal error C1189: #error: OpenMP is required error: command
'C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe'
failed with exit status 2
Not only for this source code but also for other code fails to build.
It should be noted that I installed visual 2015, visual 2017, GCC compiler in my PC. The operating system is Windows 10.
Different source code needs different types of compiler, How can I solve this issue?
The critical section of that output is fatal error C1189: #error: OpenMP is required. At a guess, I'd say that this means that you need to have OpenMP available, and you don't. There's another SO thread on installing OpenMP on Windows, which includes some pretty recent answers.

error installing openssl for python (pip)

i'm trying to install openssl using pip in order to use it with python.
i tried several versions and i get the same error!
i tried pip install cryptography and got the same error !
visual studion sdk builder is installed and worked for other packages.
please help, i attached the log after running "pip install pyopenssl !
log with the end error:
building '_openssl' extension
creating build\temp.win32-3.8\Release\build
creating build\temp.win32-3.8\Release\build\temp.win32-3.8
creating build\temp.win32-3.8\Release\build\temp.win32-3.8\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\teich\PycharmProjects\first\venv\include -ID:\Users\teich\A
ppData\Local\Programs\Python\Python38-32\include -ID:\Users\teich\AppData\Local\Programs\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
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)\Wind
ows 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\OpenSSL-Win6
4\OpenSSL-win64" /Tcbuild\temp.win32-3.8\Release\_openssl.c /Fobuild\temp.win32-3.8\Release\build\temp.win32-3.8\Release\_openssl.obj
_openssl.c
build\temp.win32-3.8\Release\_openssl.c(498): fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory

Compilation of Python extension on windows fails with missing source filename error D8003

I'm trying to build qpython (the kdb python interface) for python 3.6.3 (Anaconda) running on windows 7.
After downloading and unpacking qPython-qPython-1.2.2.zip
Executing "python setup.py build_ext --inplace"
gives...
running build_ext
building 'qpython.fastutils' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\wilsoroh\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\core\inclu
de -IC:\Users\wilsoroh\AppData\Local\Continuum\Anaconda3\include -IC:\Users\wilsoroh\AppData\Local\Continuum\Anaconda3\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\u
m" "-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\Sy
base\OCS-15_0\include\" /Tcqpython/fastutils.c /Fobuild\temp.win-amd64-3.6\Release\qpython/fastutils.obj
cl : Command line error D8003 : missing source filename
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Which looks like setup is simply not setting the paths up correctly for the compiler.
A look in the qpython directory below shows fastutils.c sitting there waiting to be compiled.
This kind of thing seems to be a regular problem when trying to build python extensions on windows.
Any help / suggestions greatly appreciated.

Error when pip installing CRFsuite in Python 3 Windows 10 x86

I'm trying to install CRFsuite 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 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>
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"
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?

Categories