pythoncythonvisual-studio-codecythonize

Cython not working properly, and unable to diagnose the issue


To make this brief, I am making a project, and I need Cython for it to work. I have read every single line of documentation when it comes to installing Cython on windows, and have followed exactly what has said. Despite this, I still can't get Cython to work properly. When I import the module, everything works fine. The issue arises when I try compiling from a .pyx file.

The C file gets generated just fine, but there are two issues. The first is that for whatever reason, I'm getting:

raise ValueError("Unknown MS Compiler Version 1929")

It doesn't end there. When I try looking for the pyd file, 0 files are generated. There just is no pyd file in the directory. In the C file, where it uses #include "Python.h", it shows an error, and gives the following message:

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (C:\Users\...\Workspace\cython_test\example_py.c) will be provided by the Tag Parser.

I have tried searching all over for ways to solve this, but absolutely nothing has helped... I tried installing MSVC, and properly set up MinGW in my environment variables. I have tried restarting my computer, uninstalling and reinstalling Python, MinGW, VSCode, and even tried looking through the documentation for ways to solve this, all to no avail.


Solution

  • I finally resolved the issue. Cython docs are recommending the wrong compiler and SDK framework for Windows. When you want Cython files to compile, you need to download SDK through Visual Studio Build Tools. Only then will you be able to compile and build for Cython...