2019년 12월 1일 일요일

installing word2vec 설치기


환경 : python 3.7
VC 2019 설치된 상태

https://pypi.org/project/word2vec/


pip install word2vec

C:\Users\USER\AppData\Local\Programs\Python\Python37\Scripts>pip install word2vec
Collecting word2vec
  Downloading https://files.pythonhosted.org/packages/ce/51/5e2782b204015c8aef0ac830297c2f2735143ec90f592b9b3b909bb89757/word2vec-0.10.2.tar.gz (60kB)
     |████████████████████████████████| 61kB 206kB/s
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-53cqqt99\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-53cqqt99\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\USER\AppData\Local\Temp\pip-install-53cqqt99\word2vec\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\USER\AppData\Local\Temp\pip-install-53cqqt99\word2vec\setup.py", line 4, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

오랜만에 설치하려고 했더니 에러가 발생합니다.

python -m pip install --upgrade pip 업그레이드 해줍니다.

다시 설치 시도, python -m pip install word2vec

C:\Users\USER\AppData\Local\Programs\Python\Python37>python -m pip install word2vec
Collecting word2vec
  Using cached https://files.pythonhosted.org/packages/ce/51/5e2782b204015c8aef0ac830297c2f2735143ec90f592b9b3b909bb89757/word2vec-0.10.2.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-xgw8dy4_\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-xgw8dy4_\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\USER\AppData\Local\Temp\pip-install-xgw8dy4_\word2vec\pip-egg-info'
         cwd: C:\Users\USER\AppData\Local\Temp\pip-install-xgw8dy4_\word2vec\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\USER\AppData\Local\Temp\pip-install-xgw8dy4_\word2vec\setup.py", line 4, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command out

Cython 설치
python -m pip install Cython

C:\Users\USER\AppData\Local\Programs\Python\Python37>python -m pip install Cython
Collecting Cython
  Downloading https://files.pythonhosted.org/packages/1f/be/b14be5c3ad1ff73096b518be1538282f053ec34faaca60a8753d975d7e93/Cython-0.29.14-cp37-cp37m-win_amd64.whl (1.7MB)
     |████████████████████████████████| 1.7MB 252kB/s
Installing collected packages: Cython
  WARNING: The scripts cygdb.exe, cython.exe and cythonize.exe are installed in 'C:\Users\USER\AppData\Local\Programs\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Cython-0.29.14

다시 설치 시도 python -m pip install word2vec

C:\Users\USER\AppData\Local\Programs\Python\Python37>python -m pip install word2vec
Collecting word2vec
  Using cached https://files.pythonhosted.org/packages/ce/51/5e2782b204015c8aef0ac830297c2f2735143ec90f592b9b3b909bb89757/word2vec-0.10.2.tar.gz
Requirement already satisfied: six in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.12.0)
Requirement already satisfied: cython in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (0.29.14)
Requirement already satisfied: numpy>=1.9.2 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.17.4)
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/61/61/c81a5f4269c59cab509855d7690e81d36429dbbe104a4a631eef4736574f/scipy-1.3.3-cp37-cp37m-win_amd64.whl (30.5MB)
     |████████████████████████████████| 30.5MB 6.4MB/s
Collecting scikit-learn
  Downloading https://files.pythonhosted.org/packages/d6/9e/6a42486ffa64711fb868e5d4a9167153417e7414c3d8d3e0d627cf391e1e/scikit_learn-0.21.3-cp37-cp37m-win_amd64.whl (5.9MB)
     |████████████████████████████████| 5.9MB 6.4MB/s
Collecting joblib>=0.11
  Downloading https://files.pythonhosted.org/packages/8f/42/155696f85f344c066e17af287359c9786b436b1bf86029bb3411283274f3/joblib-0.14.0-py2.py3-none-any.whl (294kB)
     |████████████████████████████████| 296kB 3.3MB/s
Installing collected packages: scipy, joblib, scikit-learn, word2vec
    Running setup.py install for word2vec ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-1gz0rmic\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-1gz0rmic\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-04dqp9lo\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\USER\AppData\Local\Temp\pip-install-1gz0rmic\word2vec\
    Complete output (3 lines):
    running install
    error: [WinError 2] 지정된 파일을 찾을 수 없습니다
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-1gz0rmic\word2vec\word2vec\src\win32/word2vec.c -o Scripts\word2vec.exe -O2 -Wall -funroll-loops
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-1gz0rmic\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-1gz0rmic\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-04dqp9lo\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

GCC  설치 64bit 용으로 설치함, 기본 옵션 check box도 안건들고 특히 path 설정기 기본으로 해서 어디에서나 gcc가 동작되는지 확인이 필요함
http://tdm-gcc.tdragon.net/download

설치후에는 python이 열렸던 창을 닫고 다시 cmd 창을 열어서 gcc가 동작하는지 확인합니다.
아래와 같이 나온다면 정상 입니다.
C:\Users\USER\AppData\Local\Programs\Python\Python37>gcc
gcc: fatal error: no input files
compilation terminated.


C:\Users\USER\AppData\Local\Programs\Python\Python37>python -m pip install word2vec
Collecting word2vec
  Using cached https://files.pythonhosted.org/packages/ce/51/5e2782b204015c8aef0ac830297c2f2735143ec90f592b9b3b909bb89757/word2vec-0.10.2.tar.gz
Requirement already satisfied: six in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.12.0)
Requirement already satisfied: cython in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (0.29.14)
Requirement already satisfied: numpy>=1.9.2 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.17.4)
Requirement already satisfied: scipy in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.3.3)
Requirement already satisfied: scikit-learn in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (0.21.3)
Requirement already satisfied: joblib>=0.11 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn->word2vec) (0.14.0)
Installing collected packages: word2vec
    Running setup.py install for word2vec ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-qv25yvf0\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-qv25yvf0\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-1q_o5erq\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\USER\AppData\Local\Temp\pip-install-qv25yvf0\word2vec\
    Complete output (4 lines):
    running install
    C:\Users\USER\AppData\Local\Temp\pip-install-qv25yvf0\word2vec\word2vec\src\win32/word2vec.c:21:25: fatal error: win32-port.h: No such file or directory
    compilation terminated.
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-qv25yvf0\word2vec\word2vec\src\win32/word2vec.c -o Scripts\word2vec.exe -O2 -Wall -funroll-loops
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-qv25yvf0\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-qv25yvf0\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-1q_o5erq\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.






https://github.com/zhangyafeikimi/word2vec-win32 여기에서 전체 소스 다운받음

win32-port.h 파일만 압축을 풀어서 C:\TDM-GCC-64\include 여기로 복사함

다시 설치시도 python -m pip install word2vec

C:\Users\USER\AppData\Local\Programs\Python\Python37>
C:\Users\USER\AppData\Local\Programs\Python\Python37>python -m pip install word2vec
Collecting word2vec
  Using cached https://files.pythonhosted.org/packages/ce/51/5e2782b204015c8aef0ac830297c2f2735143ec90f592b9b3b909bb89757/word2vec-0.10.2.tar.gz
Requirement already satisfied: six in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.12.0)
Requirement already satisfied: cython in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (0.29.14)
Requirement already satisfied: numpy>=1.9.2 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.17.4)
Requirement already satisfied: scipy in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (1.3.3)
Requirement already satisfied: scikit-learn in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from word2vec) (0.21.3)
Requirement already satisfied: joblib>=0.11 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn->word2vec) (0.14.0)
Installing collected packages: word2vec
    Running setup.py install for word2vec ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-sxfkdrzz\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-sxfkdrzz\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-1g851l5q\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\
    Complete output (154 lines):
    running install
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c: In function 'LearnVocabFromTrainFile':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:285:14: warning: unknown conversion type character 'l' in format [-Wformat=]
           printf("%lldK%c", train_words / 1000, 13);
                  ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:285:14: warning: format '%c' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:285:14: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:297:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Vocab size: %lld\n", vocab_size);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:297:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:298:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Words in train file: %lld\n", train_words);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:298:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c: In function 'SaveVocab':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:307:48: warning: unknown conversion type character 'l' in format [-Wformat=]
       for (i = 0; i < vocab_size; i++) fprintf(fo, "%s %lld\n", vocab[i].word, vocab[i].cn);
                                                    ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:307:48: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c: In function 'ReadVocab':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:326:17: warning: unknown conversion type character 'l' in format [-Wformat=]
         fscanf(fin, "%lld%c", &vocab[a].cn, &c);
                     ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:326:17: warning: format '%c' expects argument of type 'char *', but argument 3 has type 'long long int *' [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:326:17: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:331:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Vocab size: %lld\n", vocab_size);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:331:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:332:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Words in train file: %lld\n", train_words);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:332:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c: In function 'TrainModel':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:546:84: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       for (a = 0; a < num_threads; a++) pthread_create(&pt[a], NULL, TrainModelThread, (void *)a);
                                                                                        ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:551:17: warning: unknown conversion type character 'l' in format [-Wformat=]
         fprintf(fo, "%lld %lld\n", vocab_size, layer1_size);
                     ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:551:17: warning: unknown conversion type character 'l' in format [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:551:17: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c: In function 'TrainModelThread':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c:532:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c: In function 'LearnVocabFromTrainFile':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:179:14: warning: unknown conversion type character 'l' in format [-Wformat=]
           printf("Words processed: %lldK     Vocab size: %lldK  %c", train_words / 1000, vocab_size / 1000, 13);
                  ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:179:14: warning: unknown conversion type character 'l' in format [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:179:14: warning: format '%c' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:179:14: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:200:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("\nVocab size (unigrams + bigrams): %lld\n", vocab_size);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:200:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:201:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Words in train file: %lld\n", train_words);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:201:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c: In function 'TrainModel':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:226:14: warning: unknown conversion type character 'l' in format [-Wformat=]
           printf("Words written: %lldK%c", cn / 1000, 13);
                  ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:226:14: warning: format '%c' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c:226:14: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c: In function 'main':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:44:13: warning: unknown conversion type character 'l' in format [-Wformat=]
       fscanf(f, "%lld", &words);
                 ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:44:13: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:45:13: warning: unknown conversion type character 'l' in format [-Wformat=]
       fscanf(f, "%lld", &size);
                 ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:45:13: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:49:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Cannot allocate memory: %lld MB    %lld  %lld\n", (long long)words * size * sizeof(float) / 1048576, words, size);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:49:12: warning: unknown conversion type character 'l' in format [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:49:12: warning: unknown conversion type character 'l' in format [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:49:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:95:14: warning: unknown conversion type character 'l' in format [-Wformat=]
           printf("\nWord: %s  Position in vocabulary: %lld\n", st[a], bi[a]);
                  ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c:95:14: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c: In function 'main':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:44:13: warning: unknown conversion type character 'l' in format [-Wformat=]
       fscanf(f, "%lld", &words);
                 ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:44:13: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:45:13: warning: unknown conversion type character 'l' in format [-Wformat=]
       fscanf(f, "%lld", &size);
                 ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:45:13: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:49:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Cannot allocate memory: %lld MB    %lld  %lld\n", (long long)words * size * sizeof(float) / 1048576, words, size);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:49:12: warning: unknown conversion type character 'l' in format [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:49:12: warning: unknown conversion type character 'l' in format [-Wformat=]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:49:12: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:92:14: warning: unknown conversion type character 'l' in format [-Wformat=]
           printf("Only %lld words were entered.. three words are needed at the input to perform the calculation\n", cn);
                  ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:92:14: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:99:14: warning: unknown conversion type character 'l' in format [-Wformat=]
           printf("\nWord: %s  Position in vocabulary: %lld\n", st[a], bi[a]);
                  ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c:99:14: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c: In function 'main':
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c:46:13: warning: unknown conversion type character 'l' in format [-Wformat=]
       fscanf(f, "%lld", &words);
                 ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c:46:13: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c:48:13: warning: unknown conversion type character 'l' in format [-Wformat=]
       fscanf(f, "%lld", &size);
                 ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c:48:13: warning: too many arguments for format [-Wformat-extra-args]
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c:52:12: warning: unknown conversion type character 'l' in format [-Wformat=]
         printf("Cannot allocate memory: %lld MB\n", words * size * sizeof(float) / 1048576);
                ^
    C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c:52:12: warning: too many arguments for format [-Wformat-extra-args]
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2vec.c -o Scripts\word2vec.exe -O2 -Wall -funroll-loops
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word2phrase.c -o Scripts\word2phrase.exe -O2 -Wall -funroll-loops
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/distance.c -o Scripts\word2vec-distance.exe -O2 -Wall -funroll-loops
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/word-analogy.c -o Scripts\word2vec-word-analogy.exe -O2 -Wall -funroll-loops
    Compilation command: gcc C:\Users\USER\AppData\Local\Temp\pip-install-sxfkdrzz\word2vec\word2vec\src\win32/compute-accuracy.c -o Scripts\word2vec-compute-accuracy.exe -O2 -Wall -funroll-loops
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\word2vec
    copying word2vec\io.py -> build\lib.win-amd64-3.7\word2vec
    copying word2vec\scripts_interface.py -> build\lib.win-amd64-3.7\word2vec
    copying word2vec\utils.py -> build\lib.win-amd64-3.7\word2vec
    copying word2vec\wordclusters.py -> build\lib.win-amd64-3.7\word2vec
    copying word2vec\wordvectors.py -> build\lib.win-amd64-3.7\word2vec
    copying word2vec\_version.py -> build\lib.win-amd64-3.7\word2vec
    copying word2vec\__init__.py -> build\lib.win-amd64-3.7\word2vec
    creating build\lib.win-amd64-3.7\word2vec\tests
    copying word2vec\tests\test_word2vec.py -> build\lib.win-amd64-3.7\word2vec\tests
    copying word2vec\tests\__init__.py -> build\lib.win-amd64-3.7\word2vec\tests
    UPDATING build\lib.win-amd64-3.7\word2vec/_version.py
    set build\lib.win-amd64-3.7\word2vec/_version.py to '0.10.2'
    running build_ext
    building 'word2vec.word2vec_noop' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\word2vec
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\USER\AppData\Local\Programs\Python\Python37\include -IC:\Users\USER\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include" /Tcword2vec/word2vec_noop.c /Fobuild\temp.win-amd64-3.7\Release\word2vec/word2vec_noop.obj
    word2vec_noop.c
    C:\Users\USER\AppData\Local\Programs\Python\Python37\include\pyconfig.h(59): fatal error C1083: 포함 파일을 열 수 없습니다. 'io.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-sxfkdrzz\\word2vec\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-sxfkdrzz\\word2vec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\USER\AppData\Local\Temp\pip-record-1g851l5q\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

C:\Users\USER\AppData\Local\Programs\Python\Python37>


Visual Studio Community 버전 설치
https://visualstudio.microsoft.com/ko/thank-you-downloading-visual-studio/?sku=Community&rel=16

vs에서 io.h 삭제하였기 때문에 재설치 해도 해결 되지 않습니다.
아래와 같은 경로를 봐도 io.h 파일이 없습니다.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include

결론 : 설치 할 수 없음

VC 2017 2015 버전을 설치해야 가능합니다.



그럼 다른 대안은?


너무 설치가 안되어서 검색해봄
https://stackoverflow.com/questions/25643004/python-word2vec-not-installing

gensim 모듈을 설치하는 것입니다.

The word2vec is meant for Linux. See: https://github.com/danielfrg/word2vec
At the bottom it says there is a very experimental Windows build at: support:https://github.com/zhangyafeikimi/word2vec-win32
EDIT:
Looks like you can also install gensim: https://pypi.python.org/pypi/gensim
Then do:
from gensim.models import word

C:\Users\USER\AppData\Local\Programs\Python\Python37>python -m pip install gensim
Collecting gensim
  Downloading https://files.pythonhosted.org/packages/09/ed/b59a2edde05b7f5755ea68648487c150c7c742361e9c8733c6d4ca005020/gensim-3.8.1-cp37-cp37m-win_amd64.whl (24.2MB)
     |████████████████████████████████| 24.2MB 2.2MB/s
Requirement already satisfied: numpy>=1.11.3 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from gensim) (1.17.4)
Requirement already satisfied: scipy>=0.18.1 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from gensim) (1.3.3)
Collecting smart-open>=1.8.1
  Downloading https://files.pythonhosted.org/packages/0c/09/735f2786dfac9bbf39d244ce75c0313d27d4962e71e0774750dc809f2395/smart_open-1.9.0.tar.gz (70kB)
     |████████████████████████████████| 71kB 2.3MB/s
Requirement already satisfied: six>=1.5.0 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from gensim) (1.12.0)
Collecting boto>=2.32
  Downloading https://files.pythonhosted.org/packages/23/10/c0b78c27298029e4454a472a1919bde20cb182dab1662cec7f2ca1dcc523/boto-2.49.0-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 3.3MB/s
Requirement already satisfied: requests in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from smart-open>=1.8.1->gensim) (2.22.0)
Collecting boto3
  Downloading https://files.pythonhosted.org/packages/67/17/567f679dac6ec93611ce05637094e9736afa40e41c9ed0aaefd90de6f7e8/boto3-1.10.28-py2.py3-none-any.whl (128kB)
     |████████████████████████████████| 133kB 3.2MB/s
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (1.25.3)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (2019.6.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (from requests->smart-open>=1.8.1->gensim) (3.0.4)
Collecting s3transfer<0.3.0,>=0.2.0
  Downloading https://files.pythonhosted.org/packages/16/8a/1fc3dba0c4923c2a76e1ff0d52b305c44606da63f718d14d3231e21c51b0/s3transfer-0.2.1-py2.py3-none-any.whl (70kB)
     |████████████████████████████████| 71kB 1.5MB/s
Collecting jmespath<1.0.0,>=0.7.1
  Downloading https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
Collecting botocore<1.14.0,>=1.13.28
  Downloading https://files.pythonhosted.org/packages/8e/b3/ab9044d3aa14208f5b6f69665d5f82ad9b028809666e4e70dac1ab0bfd3a/botocore-1.13.28-py2.py3-none-any.whl (5.7MB)
     |████████████████████████████████| 5.7MB 3.3MB/s
Collecting docutils<0.16,>=0.10
  Downloading https://files.pythonhosted.org/packages/22/cd/a6aa959dca619918ccb55023b4cb151949c64d4d5d55b3f4ffd7eee0c6e8/docutils-0.15.2-py3-none-any.whl (547kB)
     |████████████████████████████████| 552kB 3.2MB/s
Collecting python-dateutil<2.8.1,>=2.1; python_version >= "2.7"
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
     |████████████████████████████████| 235kB ...
Installing collected packages: boto, docutils, jmespath, python-dateutil, botocore, s3transfer, boto3, smart-open, gensim
  Found existing installation: python-dateutil 2.8.1
    Uninstalling python-dateutil-2.8.1:
      Successfully uninstalled python-dateutil-2.8.1
    Running setup.py install for smart-open ... done
Successfully installed boto-2.49.0 boto3-1.10.28 botocore-1.13.28 docutils-0.15.2 gensim-3.8.1 jmespath-0.9.4 python-dateutil-2.8.0 s3transfer-0.2.1 smart-open-1.9.0

참고 site
https://radimrehurek.com/gensim/auto_examples/



댓글 없음:

댓글 쓰기