Error installing multi-rake in python (or pycld2) on Microsoft - python

When I try to install pycld2 (pip install pycld2), I have the following error:
enter image description here
Installing collected packages: pycld2
DEPRECATION: pycld2 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pycld2 ... error
error: subprocess-exited-with-error
× Running setup.py install for pycld2 did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycld2
copying pycld2\__init__.py -> build\lib.win-amd64-3.9\pycld2
running build_ext
building 'pycld2._pycld2' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pycld2
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Then, if I install the "Microsoft C++ Build Tools", with the Visual Studio Installer--C++ Build Tools for Desktop
enter image description here
and I have the next error:
Building wheels for collected packages: pycld2
Building wheel for pycld2 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [39 lines of output]
running bdist_wheel
The [wheel] section is deprecated. Use [bdist_wheel] instead.
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycld2
copying pycld2\__init__.py -> build\lib.win-amd64-3.9\pycld2
running build_ext
building 'pycld2._pycld2' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\Users
creating build\temp.win-amd64-3.9\Release\Users\Adrian
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\public -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt /EHsc /TpC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\encodings.cc /Fobuild\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\encodings.obj -w -O2 -m64 -fPIC
cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-m64'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-fPIC'
encodings.cc
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\public -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt /EHsc /TpC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\pycldmodule.cc /Fobuild\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\pycldmodule.obj -w -O2 -m64 -fPIC
cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-m64'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-fPIC'
pycldmodule.cc
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\public -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt /EHsc /TpC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal/cld2_generated_cjk_compatible.cc /Fobuild\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal/cld2_generated_cjk_compatible.obj -w -O2 -m64 -fPIC
cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-m64'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-fPIC'
cld2_generated_cjk_compatible.cc
C:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal\cld2_generated_cjk_compatible.cc : fatal error C1083: No se puede abrir el archivo generado por el compilador: '': Invalid argument
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycld2
Running setup.py clean for pycld2
Failed to build pycld2
Installing collected packages: pycld2
Running setup.py install for pycld2 ... error
error: subprocess-exited-with-error
× Running setup.py install for pycld2 did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycld2
copying pycld2\__init__.py -> build\lib.win-amd64-3.9\pycld2
running build_ext
building 'pycld2._pycld2' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\Users
creating build\temp.win-amd64-3.9\Release\Users\Adrian
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2
creating build\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\public -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt /EHsc /TpC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\encodings.cc /Fobuild\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\encodings.obj -w -O2 -m64 -fPIC
cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-m64'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-fPIC'
encodings.cc
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\public -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt /EHsc /TpC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\pycldmodule.cc /Fobuild\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\bindings\pycldmodule.obj -w -O2 -m64 -fPIC
cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-m64'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-fPIC'
pycldmodule.cc
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal -IC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\public -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include -IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt -IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt /EHsc /TpC:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal/cld2_generated_cjk_compatible.cc /Fobuild\temp.win-amd64-3.9\Release\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal/cld2_generated_cjk_compatible.obj -w -O2 -m64 -fPIC
cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-m64'
cl : L¡nea de comandos warning D9002 : se omite la opci¢n desconocida '-fPIC'
cld2_generated_cjk_compatible.cc
C:\Users\Adrian\AppData\Local\Temp\pip-install-ulnf3ec2\pycld2_dbee1b48c2e2491bb1ff0570cfac0386\cld2\internal\cld2_generated_cjk_compatible.cc : fatal error C1083: No se puede abrir el archivo generado por el compilador: '': Invalid argument
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pycld2
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I tried to install that, to use --pre, to use pip install nameofrepositryingithub...and nothing works.

Related

Unable to install python ldap module on windows

Tried installing python-ldap, but failed
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=3.4.0 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -IC:\Users\rathod\AppData\Local\Programs\Python\Python39\include -IC:\Users\rathod\AppData\Local\Programs\Python\Python39\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-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" /TcModules/LDAPObject.c /Fobuild\temp.win-amd64-cpython-39\Release\Modules/LDAPObject.obj
LDAPObject.c
c:\users\rathod\appdata\local\temp\pip-install-dkw9jd4z\python-ldap_05f9ed21408d4097a9c6bd894511d8b7\modules\common.h(15): fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for python-ldap
Failed to build python-ldap
ERROR: Could not build wheels for python-ldap, which is required to install pyproject. toml-based projects
Tried using few of the .whl files from https://www.lfd.uci.edu/~gohlke/pythonlibs/#_python-ldap, but failed
PS C:\Users\rathod\source\repos\00 Dell-Gitlab staging\replication_status> pip install .\python_ldap-3.4.0-cp311-cp311-win32.whl
ERROR: python_ldap-3.4.0-cp311-cp311-win32.whl is not a supported wheel on this platform.
Has anyone faced same challenge, and if there is any way to install this old module on windows system?

anaconda cythonize C++ on windows 10

I have c++ code that compiles fine in MSVS 2015 which is installed on my PC. I've been tasked to make a python extension using cython to be able to call c++ function from our python application. I have installed anaconda 5.2 w/ cython installed already. The c++ has a bunch of header files that need to be included when compiling. I'm trying to build one function and am running into the same error.
My test.pyx looks like this for the one function:
cimport test
cimport cython
def pxd_PIXCIclose():
res = test.pxd_PIXCIclose()
return res
The test.pxd is as follows:
cdef extern from "D:\epix\inc\xcliball.h":
int pxd_PIXCIclose()
setup.py is:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules = Extension(
name = "test",
sources=["test.pyx"],
include_dirs=["D:\epix\lib", "D:\epix\inc"],
library_dirs="D:\epix\inc\XCLIBW64.lib","D:\epix\lib\PXIPLW64.lib"]
)
setup(
name = "test.pyx",
ext_modules = cythonize([ext_modules])
)
The test.c is created but then I get a bunch of build errors on the headers in the C++ include folder:
python setup.py build_ext --inplace --compiler=msvc
Compiling test.pyx because it depends on .\test.pxd.
[1/1] Cythonizing test.pyx
running build_ext
building 'test' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\epix\lib -ID:\epix\inc -
IC:\Anaconda3\include -IC:\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.10586.0\ucrt" "-IC:\Program Files
(x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10586.0\winrt" /Tctest.c
/Fobuild\temp.win-amd64-3.6\Release\test.obj
test.c
d:\epix\inc\pxlibsv.h(312): error C2061: syntax error: identifier 'HANDLE'
d:\epix\inc\pxlibsv.h(317): error C2059: syntax error: '}'
d:\epix\inc\pxlibsv.h(827): error C2143: syntax error: missing ')' before
'*'
d:\epix\inc\pxlibsv.h(827): error C2081: 'HANDLE': name in formal parameter
list illegal
d:\epix\inc\pxlibsv.h(827): error C2143: syntax error: missing ';' before
'*'
d:\epix\inc\pxlibsv.h(827): error C2059: syntax error: '*'
.
.
.
d:\epix\inc\xclibsc.h(369): fatal error C1003: error count exceeds 100;
stopping compilation
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio
14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
I'm guessing my setup.py is not correct? Anyone have any pointers on what is happening?
Update to my original post, by adding #include windows.h, the original 'HANDLE' error is now gone but I received this link error now:
(base) d:\epix\cython>python setup.py build_ext --inplace --compiler=msvc
running build_ext
building 'test' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Anaconda3\include -ID:\epix\lib -
ID:\epix\inc -IC:\Anaconda3\include -IC:\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.10586.0\ucrt" "-IC:\Program Files
(x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.10586.0\winrt" /Tctest.c
/Fobuild\temp.win-amd64-3.6\Release\test.obj
test.c
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL
/MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Anaconda3\Lib
/LIBPATH:D:\epix\inc\XCLIBW64.lib /LIBPATH:D:\epix\lib\PXIPLW64.lib
/LIBPATH:C:\Anaconda3\libs /LIBPATH:C:\Anaconda3\PCbuild\amd64
"/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64"
"/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows
Kits\10\lib\10.0.10586.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows
Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows
Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit_test build\temp.win-amd64-
3.6\Release\test.obj /OUT:d:\epix\cython\test.cp36-win_amd64.pyd
/IMPLIB:build\temp.win-amd64-3.6\Release\test.cp36-win_amd64.lib
test.obj : warning LNK4197: export 'PyInit_test' specified multiple times;
using first specification
Creating library build\temp.win-amd64-3.6\Release\test.cp36-win_amd64.lib
and object build\temp.win-amd64-3.6\Release\test.cp36-win_amd64.exp
test.obj : error LNK2001: unresolved external symbol pxd_PIXCIclose
d:\epix\cython\test.cp36-win_amd64.pyd : fatal error LNK1120: 1 unresolved
externals error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio
14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120
Any suggestions on resolving this error? Thank you.
Based on compiler output, HANDLE is not defined. Did you know, that with VS2015 you need to add path to SDK ? It is not included, as I can see. Add C:\Program Files (x86)\Windows Kits\10 \ include\ platformtoolset\um to path. Platformtoolset will define subfolder in yours include path. Hope it helps.
By adding #include windows.h to my header and then changing my original setup.py to the following:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules = Extension(
name = "test",
sources=["test.pyx"],
include_dirs=["D:\epix\lib", "D:\epix\inc"],
library_dirs=["D:\epix\inc"],
libraries=["XCLIBW64", "PXIPLW64"]
)
setup(
name = "test.pyx",
ext_modules = cythonize([ext_modules])
I was able to successfully cythonize one of the functions in my c project. Thank you to all who gave me suggestions that pointed me in the right direction.

OpenFST Installation Error on Windows With pip

I want to use openfst python wrapper on my python application.
When I run
pip install openfst
for Python 3.6 gave error as the following.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\aliye\Anaconda3\include -IC:\Users\aliye\Anaconda3\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\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 /Tppywrapfst.cc /Fobuild\temp.win-amd64-3.6\Release\pywrapfst.obj -std=c++11 -Wno-unneeded-internal-declaration -Wno-unused-function
cl : Command line error D8021 : invalid numeric argument '/Wno-unneeded-internal-declaration'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Obviously, it looks like the Visual Studio compiler is complaining about /Wno-unneeded-internal-declaration flag while it is trying to build the C extensions.
The easiest solution would be to download a pre-compiled version that matches your system at their website
Also, based on their site, it seems that they used Visual Studio 2013.You may be able to install and compile it using VS13.

cl : Command line error D8003 : missing source filename when i compile .py to .pyd with Cython

I get this error when compile hello.py with "python setup.py build_ext --inplace" . I have searched for the error but get nothing. Has anyone ever solved a similar problem? os=win7-64, python=3.6.2, cython=0.27.1, visual stdudio=2015.
# hello.py
def say_hello_to(name):
print("Hello %s!" % name)
# setup.py
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("hello.py")
)
E:\Crawler>python setup.py build_ext --inplace
running build_ext
building 'hello' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox
/W3 /GL /DNDEBUG /MD "-ID:\Program Files (x86)\Python36-32\include" "-ID:\Progr
am Files (x86)\Python36-32\include" "-IC:\Program Files (x86)\Microsoft Visual S
tudio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10
240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-
IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program F
iles (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\Microsoft SDKs\Windo
ws\v7.0\Include\" /Tchello.c /Fobuild\temp.win32-3.6\Release\hello.obj
cl : Command line error D8003 : missing source filename
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\
cl.exe' failed with exit status 2

Compiling with Cython on Windows: missing source filename

I'm trying to compile a hello world example with Cython on Windows 10.
I have visual studio 2015 community.
Python 3.5.2
My setup.py looks like this:
from distutils.core import setup
from Cython.Build import cythonize
setup (
name='print hello world',
ext_modules=cythonize("print_h_w.pyx", compiler_directives=
{'language_level': 3}),
)
The file I'm trying to compile looks like this:
print('Hello World')
I build with this command:
python setup.py build_ext --inplace
I keep getting this error:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -
IC:\Users\Paul\AppData\Local\Programs\Python\Python35\include -
IC:\Users\Paul\AppData\Local\Programs\Python\Python35\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.14393.0\ucrt" "-IC:\Program Files
(x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.14393.0\winrt" "-IC:\Program Files
(x86)\Windows Kits\10\Include\10.0.14393.0\ucrt\" /Tcprint_h_w.c
/Fobuild\temp.win-amd64-3.5\Release\print_h_w.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
I've been doing a lot of research but I've turned up a lot of nothing. How can I fix this?
I think you should have import cython in your print_h_w.pyx file :
import cython
print("hello world")

Categories

Resources