Skip to main content

Enable C Extension for gensim on Windows

·1 min

These days, I’m working on some text classification works, and I use gensim ’s doc2vec function.

When using gensim, it shows this warning message:

C extension not loaded for Word2Vec, training will be slow.

I search this on Internet and found that gensim has rewrite some part of the code using cython rather than numpy to get better performance. A compiler is required to enable this feature.

I tried to install mingw and add it into the path, but it’s not working.

Finally, I tried to install Visual C++ Build Tools and it works.

If this output is not -1, then it’s fine.

from gensim.models import word2vec
print(word2vec.FAST_VERSION)