I'm trying to install cython and i'm having problems installing the c++ compiler. I have setup.py and main.pyx
setup.py
from setuptools import setup
from Cython.Build import cythonize
setup(
name="My hello app",
ext_modules=cythonize("*.pyx", compiler_directives={'always_allow_keywords': True}),
)
when i try to build the main extension, i do python setup.py build_ext --inplace
and get this error:
running build_ext
building 'main' extension
cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\xxx\AppData\Local\Programs\Python\Python310\include -IC:\Users\xxx\AppData\Local\Programs\Python\Python310\Include /Tcmain.c /Fobuild\temp.win-amd64-cpython-310\Release\main.obj
error: command 'cl.exe' failed: None
I have MinGW/bin
added in path.
In this answer someone suggested:
Then, instead of the normal Command Prompt or PowerShell, use one of the special command prompts in the Visual Studio folder in Start Menu. This sets up PATH automatically, so that cl.exe can be found. For 32-bit Python, use x86 Native Tools Command Prompt. For 64-bit Python, use x64 Native Tools Command Prompt.
And so i tried it, however when i tried to open any of the Native Tools Command Prompt i got an error Windows couldn't find cmd.exe
.
I tried reinstalling and repairing visual studio build tools 2022 but with no sucess. I very desperate now so i would appreciate any kind of help.
Ok, after around 10 hours of pain and struggling i found out the problem, It was In the enviroment variables. the ComSpec one points to the cmd, and i had an extra semicolon there for some reason, so i manually added cmd.exe and everything works now... So yeah, one stupid semicolon took away 10 hours of my life.