[파이썬/우분투/wsl] webrtcvad 설치 오류

Apic·2023년 3월 30일
0

우분투/wsl

목록 보기
1/5

pip3 install webrtcvad을 하는데 오류가 발생했다.

  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fz08njwh/webrtcvad/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fz08njwh/webrtcvad/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-r64ms1yx
       cwd: /tmp/pip-install-fz08njwh/webrtcvad/
  Complete output (20 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  copying webrtcvad.py -> build/lib.linux-x86_64-3.9
  running build_ext
  building '_webrtcvad' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/cbits
  creating build/temp.linux-x86_64-3.9/cbits/webrtc
  creating build/temp.linux-x86_64-3.9/cbits/webrtc/common_audio
  creating build/temp.linux-x86_64-3.9/cbits/webrtc/common_audio/signal_processing
  creating build/temp.linux-x86_64-3.9/cbits/webrtc/common_audio/vad
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWEBRTC_POSIX -Icbits -I/usr/include/python3.9 -c cbits/pywebrtcvad.c -o build/temp.linux-x86_64-3.9/cbits/pywebrtcvad.o
  cbits/pywebrtcvad.c:1:10: fatal error: Python.h: No such file or directory
      1 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for webrtcvad
  Running setup.py clean for webrtcvad
Failed to build webrtcvad
Installing collected packages: webrtcvad
    Running setup.py install for webrtcvad ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fz08njwh/webrtcvad/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fz08njwh/webrtcvad/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-qukjsp44/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/dlsdud/.local/include/python3.9/webrtcvad
         cwd: /tmp/pip-install-fz08njwh/webrtcvad/
    Complete output (20 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    copying webrtcvad.py -> build/lib.linux-x86_64-3.9
    running build_ext
    building '_webrtcvad' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/cbits
    creating build/temp.linux-x86_64-3.9/cbits/webrtc
    creating build/temp.linux-x86_64-3.9/cbits/webrtc/common_audio
    creating build/temp.linux-x86_64-3.9/cbits/webrtc/common_audio/signal_processing
    creating build/temp.linux-x86_64-3.9/cbits/webrtc/common_audio/vad
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWEBRTC_POSIX -Icbits -I/usr/include/python3.9 -c cbits/pywebrtcvad.c -o build/temp.linux-x86_64-3.9/cbits/pywebrtcvad.o
    cbits/pywebrtcvad.c:1:10: fatal error: Python.h: No such file or directory
        1 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fz08njwh/webrtcvad/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fz08njwh/webrtcvad/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-qukjsp44/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/dlsdud/.local/include/python3.9/webrtcvad Check the logs for full command output.

잘 보면 Python.h라는 파일이 없다고 나온다.

먼저 오류 메시지에 나온데로 경로를 따라가 본다.
/user/include/python3.9/

잘 보니 python3.9라는 폴더가 없다...

여기 저기 찾아봤는데 처음에는 아래 명령어를 치라고 한다.
sudo apt-get install python3-dev
저 명령어를 쳤을 때 출력중 이런 문장이 나온다.
python3-dev is already the newest version (3.8.2-0ubuntu2).
나는 3.9를 사용하고 있는데 저녀석을 3.8에 설치하고 있다! (기본이 3.8이여서 그런듯 하다)

그래서 3.8이 아닌 3.9를 설치하기 위해 아래와 같은 명령어를 사용했다.
sudo apt-get install python3.9-dev

설치를 해주고 다시 pip3 install webrtcvad를 해줬더니...

Collecting webrtcvad
  Using cached webrtcvad-2.0.10.tar.gz (66 kB)
Building wheels for collected packages: webrtcvad
  Building wheel for webrtcvad (setup.py) ... done
  Created wheel for webrtcvad: filename=webrtcvad-2.0.10-cp39-cp39-linux_x86_64.whl size=80877 sha256=c64c8f573de25f201a66435047061e5d27eb055e383cf57165c7d2bd2aa6bdd8
  Stored in directory: /home/dlsdud/.cache/pip/wheels/1f/fe/28/e8f0d5847ae2642b49fa974db1cea44d59ab59d0251c12f17b
Successfully built webrtcvad
Installing collected packages: webrtcvad
Successfully installed webrtcvad-2.0.10

잘 되었다!

profile
코딩 공부하는 사람

0개의 댓글