5

I'm using the library node2vec, which is based on gensim word2vec model to encode nodes in an embedding space, but when i want to fit the word2vec object I get this warning:

C:\Users\lenovo\Anaconda3\lib\site-packages\gensim\models\base_any2vec.py:743: UserWarning: C extension not loaded, training will be slow. Install a C compiler and reinstall gensim for fast training.

Can any one help me to fix this issue please ?

SmrtGrunt
  • 869
  • 12
  • 25
Ilyes
  • 581
  • 1
  • 5
  • 12
  • Welcome to SO! Before posting, please search to see if your question has already been asked. In this case, your answer might be found [here](https://stackoverflow.com/questions/50306710/gensim-c-extension-not-loaded-training-will-be-slow). – SmrtGrunt May 04 '19 at 00:43
  • Possible duplicate of [Gensim: "C extension not loaded, training will be slow."](https://stackoverflow.com/questions/50306710/gensim-c-extension-not-loaded-training-will-be-slow) – SmrtGrunt May 04 '19 at 00:43
  • 1
    @SmrtGrunt, the duplicate might not be helpful here, because this is on a windows machine and the duplicate gives instructions for ubuntu. – cel May 04 '19 at 08:42
  • 1
    It would be helpful to include in your question how you installed gensim. Did you use pip or conda? – cel May 04 '19 at 08:44
  • @cel i used pip install gensim, and i upgrade to the latest version 3.7.2 but still ... – Ilyes May 04 '19 at 10:46
  • 1
    @Aziziilias, I would recommend uninstalling with pip and reinstalling with `conda install gensim` - packages which rely on extension modules can sometimes be tricky to get to work on windows. – cel May 04 '19 at 13:43
  • 1
    @cel with conda install gensim command i installed the 3.4.0 which works very well, thank you dude – Ilyes May 04 '19 at 16:35

4 Answers4

9

gensim relies on extension modules that need to be compiled. Both defaults and the conda-forge channel provide prebuilt versions that will work out of the box.

conda install gensim

or

conda install -c conda-forge gensim

are probably the easiest way to get gensim to work.

cel
  • 30,017
  • 18
  • 97
  • 117
1

For me, degrading back to Gensim version 3.7.1 from 3.7.3 worked.

A. McMount
  • 141
  • 6
1

anaconda prompt conda update conda-build

== windows 7 (32bit) python 3.7.3 conda-build 3.18.5 gensim 3.4.0

中村宏
  • 11
  • 1
0

I've faced this issue for a long time when I was running W2V Models which requires 'gensim'. First of all I've installed Anaconda Navigator and then installed required packages using pip. I've installed gensim manually using pip in cmd. When I run the W2V model, it took 40 min to train and give the result, which made me annoying and wasted a lot of time.

This problem got solved now. I just did what the warning showed. I've uninstalled gensim from my computer. Prior to that I've already created a system path of mingw-w64 in the environment variable which is an environment for c,c++ etc., programs. Later, I've reinstalled gensim using 'pip install gensim'.

Now the program is running within seconds which made a drastic change in the execution time.

Hope this helps...