기본 콘텐츠로 건너뛰기

[pip install]distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/


안녕하세요 이번 포스팅은 pip를 설치하면서 발생하는 에러를 해결하는 방법에 대해서 알아보겠습니다.

개발 환경
  • OS: Windows 10
  • python: Python 3.8.0
  • pip: pip 19.3.1

저는 아래 두 개 라이브러리를 설치하면서 위와 같은 에러가 발생했습니다.

pip install tensor2tensor 
pip install konlpy

참고로 첫 번째 라이브러리는 transformer 모델을 설치하는 명령어이고 두 번째는 형태소 분석을 위한 라이브러 입니다.

[Error Message]
ERROR: Command errored out with exit status 1: 
     command: 'c:\users\ynebu\appdata\local\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Public\\Documents\\ESTsoft\\CreatorTemp\\pip-install-b27rktjo\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\Public\\Documents\\ESTsoft\\CreatorTemp\\pip-install-b27rktjo\\gevent\\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\Public\Documents\ESTsoft\CreatorTemp\pip-install-b27rktjo\gevent\pip-egg-info' 
         cwd: C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-b27rktjo\gevent\ 
    Complete output (113 lines): 
    Traceback (most recent call last): 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver 
        return self.find_available_vc_vers()[-1] 
    IndexError: list index out of range 

    During handling of the above exception, another exception occurred: 

    Traceback (most recent call last): 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules 
        yield saved 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context 
        yield 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup 
        _execfile(setup_script, ns) 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile 
        exec(code, globals, locals) 
      File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\easy_install-lolgdivb\cffi-1.13.2\setup.py", line 127, in  
        HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives", 
      File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\easy_install-lolgdivb\cffi-1.13.2\setup.py", line 105, in uses_msvc 
        include_dirs=include_dirs) 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\distutils\command\config.py", line 225, in try_compile 
        self._compile(body, headers, include_dirs, lang) 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\distutils\command\config.py", line 132, in _compile 
        self.compiler.compile([src], include_dirs=include_dirs) 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\distutils\_msvccompiler.py", line 360, in compile 
        self.initialize() 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\distutils\_msvccompiler.py", line 253, in initialize 
        vc_env = _get_vc_env(plat_spec) 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env 
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env() 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 843, in __init__ 
        self.si = SystemInfo(self.ri, vc_ver) 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 485, in __init__ 
        self.vc_ver = vc_ver or self._find_latest_available_vc_ver() 
      File "c:\users\ynebu\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver 
        raise distutils.errors.DistutilsPlatformError(err) 
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

[Resolve]
에러 메시지에서 가이드 해줬듯이 visualstudio를 다운받아서 설치하셔야 합니다.
https://visualstudio.microsoft.com/downloads/ 
위 사이트에 접속하시면 세 개의 다운로드할 수 있습니다. Community를 다운 받으시길 바랍니다.

다운로드가 완료되면 설치할 워크로드를 선택하는 화면이 나타납니다. pip와 관련된 항목인 "C++를 사용한 데스크톱 개발"을 선택하고 설치합니다.

비고) 저는 처음 설치할 때는 다운로드를 완료하고 설치하는데 오랜 걸리고 설치가 안돼서 컴퓨터를 리붓 후 다시 했습니다.

pip install 명령어를 다시 수행하시면 라이브러리가 설치하시면 정상적으로 설치됨을 확인할 수 있습니다.

감사합니다.

댓글

이 블로그의 인기 게시물

[Deep Learning-딥러닝] 신경망 구조

뉴런 표현 및 연산 방법 생물학의 신경 세포를 단순화하여 모델링 한것이 뉴런입니다.  뉴런은 신경망의 기본 단위 입니다. 뉴런은 여러 신호를 받아, 하나의 신호를 만들어 전달하는 역할을 합니다. 출력을 내기 전에 활성 함수(activation function)을 통해서 비선형 특성을 가할 수 있습니다. 뉴런 연산 방법은 다음과 같습니다. 두 벡터  가중치 weight와 입력 x의  내적 을 구한 후 모두 합한다. 편향을 더합니다.  편향이 없으면, 추세선은 원점을 꼭 지나야 합니다. 활성 함수를 적용 해 비선형 함수로 만듭니다. 두 벡터의 내적은 다음과 같이 표현할 수 있습니다. 두 벡터의 내적 FC(Fully Connected) Layer Matrix 곱셈 연산 표현 방법 뉴런이 모인 한 단위를 계층(Layer)라고 하며, 이전 계층과 다음 계층의 모든 뉴런이 서로 연결된 계층을 Fully-Connected Layer(Dense Layer)라고 합니다. N개의 입력, M개의 출력이 있는 네트워크 예제입니다. 매트릭스  W 의  w 0 는 (N*1)의 벡터이며, 이런  w 0 를 M개 나열되어 있습니다. 입력  x 는 N개라 행렬로 표현하면 (N*1)로 표현됩니다. 가중치를 transpose하여 (M*N)*(N*1)을 연산하여 출력은 (M*1) 형태가 됩니다. 얕은 신경망 - Shallow Neural Network 구조 얕은 신경망 - Shallow Neural Network 입력, 은닉, 출력 3개의 계층으로 되어 있으며, 은닉 계측과 출력 계층이 Fully Connected 계층인 모델을 얕은 신경망(Shallow Neural Network)라고 합니다. 입력 계층(Input Layer) 아무런 연산 없이 은닉계층으로 값을 전달함. 계층의 크기=Node의 개수=입력 Scalar의 수=입력 Vecto...

SentencePiece 설치 및 사용법

Jupyter notebook 사용 기준으로 설치 및 사용법을 설명합니다. Sentencepiece 특징 및 기능 설명은 다음 사이트에서 참고 바랍니다. https://sungwoony.blogspot.com/2020/04/sentencepiece.html one-sentence-per-line raw corpus file.  tokenizer, normalizer 또는 preprocessor를 실행할 필요가 없습니다. Default로, Unicode NFKC로 SentencePiece input을 정규화 합니다.  설치방법 VM환경에 pip library가 설치되어 있어야 하며, 다음 명령어를 수행하면 설치됩니다. pip install sentencepiece 사용법 Sentencepiece library import setencepiece를 import해야 하며 관례적으로 spm으로 사용합니다. Train SentencePiece Model from corpuse botchan.txt 파일을 다음 사이트에서 다운로드 받을 수 있습니다. https://github.com/google/sentencepiece/blob/master/data/botchan.txt --mode_type의 기본은 uni type입니다. --model_type에 bpe를 넣으면 bpe 타입으로 생성됩니다. Train이 완료되면 "m.uni.model"과 "m.bpe.model" 이 생성됩니다. 둘 의 차이점은 다음에 확인할 수 있습니다. Option Name Description input 파일목록은 쉼표로 구분합니다. model_prefix output model로 prefix. <model_name>.model과 <model_name>.vocab 이 생성됩니다. vocab_size vocabulary size, e.g.. 8000, 16000, o...

[Deep Learning-딥러닝]SRU(Simple Recurrent Unit)

SRU(Simple Recurrent Unit) SRU는 병렬화와 시퀀스 모델링이 가능한 light recurrence한 unit입니다. 기존 RNN Architecture(RNN, LSTM, GRU)는 previous time step에 대한 의존성 때문에 병렬처리가 불가능하여 학습 속도가 느렸습니다. 이런 단점을 SRU는 높은 병렬화 및 시퀀스 모델링 기능을 제공하여 학습시간 단축시켰습니다. SRU는 분류, 질의응답에서 cuDNN-optimized LSTM보다 5~9배 빠른 속도를 보였고, LSTM과 convolutional models보다 좋은 성능을 보였습니다. 특징 SRU의 state연산은 time-dependent이지만, 각 state 차원은 independent입니다. 이것은 hidden dimension과 time steps에서 병렬화 연산하는 CUDA-level optimization으로 병렬 처리 가능합니다. SRU는 convolutions을 더 많은 recurrent 연결로 대체하였습니다(QRNN과 KNN과 같이). 이건 적은 연산으로 모델링을 유지합니다. SRU는 highway connection방법과 deep architecture에서 gradient전파에 맞게 조정된 매개 변수 초기화 체계를 사용하여 deep recurrent models training을 개선합니다. 연산방법 SRU는 forget gate, state, reset gate, hidden state 연산을 수행합니다. Light recurrence (1, 2번 수식) Forget gate: 정보 흐름을 제어 State: 이전 state와 현재 입력을 forget gate에 따라 조정 특징 - 문자열 정보를 위해 input x와 state c를 연산 - 이전 state에 영향을 받음 - 병렬처리를 위해 matrix multiplication 대신 point-wise multiplication 연산 수행 Highway network (3, 4번 수식) Hidden ...