Solving unresolved external symbol errors


When compiling certain C++ python extension included in standard libs, many users run into unresolved external symbol errors, especially under Windows. I do run into such an issue while trying to install the lib fairseq from facebook. And they don’t seem to be willing to fix it. So, the developers need to fix it by themselves.

The error that is triggered is the following:
module.obj : error LNK2001: unresolved external symbol __imp__PyModule_Create2

Can someone explain me what this __imp__PyModule_Create2 function does? And why is it missing from standard python libraries under Windows?


You are using a module that was compiled for a different version of python.

You need to have a version of the module that is compatible with the version of python you are using,

It is often the case that when a new version of python is released there is a time delay before modules are built and released from the new python version.

Interesting… I’ve tried to install fairseq with pip and didn’t get any warning about the version of python I am using. The documentation says that the minimum version is 3.8.

I tried with python versions 3.8 and 3.9 but it didn’t work better… Though, I managed to install the lib under Linux without any problem. So, I still wonder what’s going on.