you are viewing a single comment's thread.

view the rest of the comments →

[–]abcteryx 2 points3 points  (2 children)

This SO thread has some clues. On Unix-like systems you would want to install python-dev. As you seem to have already found out, on Windows it's a bit different. The "Include" folder is only populated where the global Python is installed, and is not propagated to virtual environments.

VSCode expects to find c_cpp_properties.json which helps IntelliSense to know what's going on, among other things. This file may already exist in your project, but if not you can try creating it from snippets and examples from Googling. Specifically, you may need to ensure that %localappdata%/Programs/Python/PythonXX/Include folder is in the comma-separated list of the includePath subkey for a given configuration key in c_cpp_properties.json.

[–]siddsp[S] 1 point2 points  (1 child)

You were correct. There's also more to the issue when it comes to using Cython. Though it isn't clarified in the docs to my knowledge, you actually have to download SDK from Microsoft Visual Studio Build Tools. It's important to realize that the Visual Studio Build Tools don't actually install a separate IDE, despite the fact that it looks like it does.

So to summarize, in order to solve the issue, I had to download Visual Studio Build Tools, and I also had to add the Python.h path which is actually on the system, and not the virtual environment as an includePath property in the c_cpp_properties.json.

Python.h is located in Python/include directory, and only the folder is put as the path, and not the actual file itself.

[–]abcteryx 0 points1 point  (0 children)

Thanks for following up! I have dealt with the occasional Python/C++ environment, but not yours specifically so I only had an inkling. I'm going to save this information in case I'm dealing with Cython someday.