Linux Mint PyAudio kurulmuyor

tornatezgahi

Hectopat
Katılım
8 Kasım 2020
Mesajlar
219
Daha fazla  
Cinsiyet
Diğer
Selam,

Linux Mint'a PyAudio kurmaya çalışıyorum. Bu hatayı verdi:
Kod:
(env) python3 -m pip install pyaudio
Collecting pyaudio
  Using cached PyAudio-0.2.13.tar.gz (46 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-310/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/src
      creating build/temp.linux-x86_64-cpython-310/src/pyaudio
      x86_64-unknown-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -fPIC -I/usr/local/include -I/usr/include -I/home/mete/Desktop/jarvis/env/include -I/usr/include/python3.10 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-310/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-unknown-linux-gnu-gcc' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

Bende PortAudio kurmak için terminali açtım ve kurduğumu zannediyorum.
Kod:
mete@mete-linuxmint:~$ sudo apt-get install portaudio19-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  portaudio19-doc
The following NEW packages will be installed:
  portaudio19-dev
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/106 kB of archives.
After this operation, 629 kB of additional disk space will be used.
Selecting previously unselected package portaudio19-dev:amd64.
(Reading database ... 567419 files and directories currently installed.)
Preparing to unpack .../portaudio19-dev_19.6.0-1.1_amd64.deb ...
Unpacking portaudio19-dev:amd64 (19.6.0-1.1) ...
Setting up portaudio19-dev:amd64 (19.6.0-1.1) ...

Bunların hepsini yaptıktan sonra hata devam ediyor, ne yapmalıyım? (venv kullanıyorum ve IDE PyCharm)

Pycharm hatasını eklemeyi unutmuşum:
Kod:
sh: line 1: mpg123: command not found
sh: line 1: mpg123: command not found
Traceback (most recent call last):
  File "/home/mete/Desktop/jarvis/env/lib/python3.10/site-packages/speech_recognition/__init__.py", line 108, in get_pyaudio
    import pyaudio
ModuleNotFoundError: No module named 'pyaudio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mete/Desktop/jarvis/main.py", line 62, in <module>
    query = take_user_input().lower()
  File "/home/mete/Desktop/jarvis/main.py", line 36, in take_user_input
    with sr.Microphone() as source:
  File "/home/mete/Desktop/jarvis/env/lib/python3.10/site-packages/speech_recognition/__init__.py", line 80, in __init__
    self.pyaudio_module = self.get_pyaudio()
  File "/home/mete/Desktop/jarvis/env/lib/python3.10/site-packages/speech_recognition/__init__.py", line 110, in get_pyaudio
    raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation

Bu da kod:
Python:
#!/usr/bin/env python
from gtts import gTTS
import os
import requests
from functions.os_ops import open_discord
from decouple import config
from datetime import datetime
import speech_recognition as sr
from random import choice
from utils import opening_text


def speak(text):
    """Used to speak whatever text is passed to it"""
    
    tts = gTTS(text, lang='tr')
    tts.save("./output/output.mp3")
    os.system("mpg123 output.mp3")

def greet_user():
    """Greets the user according to the time"""
    
    hour = datetime.now().hour
    if (hour >= 6) and (hour < 12):
        speak(f"Günaydın")
    elif (hour >= 12) and (hour < 16):
        speak(f"Tünaydın")
    elif (hour >= 16) and (hour < 19):
        speak(f"İyi akşamlar")
    speak(f"Ben Jarvis. Nasıl yardımcı olabilirim?")

def take_user_input():
    """Takes user input, recognizes it using Speech Recognition module and converts it into text"""

    r = sr.Recognizer()
    with sr.Microphone() as source:
        print('Listening....')
        r.pause_threshold = 1
        audio = r.listen(source)

    try:
        print('Recognizing...')
        query = r.recognize_google(audio, language='tr')
        if not 'çıkış' in query or 'kapanabilirsin' in query:
            speak(choice(opening_text))
        else:
            hour = datetime.now().hour
            if hour >= 21 and hour < 6:
                speak("İyi geceler, Kendinize iyi bakın!")
            else:
                speak('İyi günler efendim!')
            exit()
    except Exception:
        speak('Anlayamadım, bir daha tekrar eder misin?')
        query = 'None'
    return query


if __name__ == '__main__':
    greet_user()
    while True:
        query = take_user_input().lower()

        if 'discordu aç' in query:
            open_discord()
 
Eksik kütüphane var. Aşağıdaki komutla kurmayı dene.

Bash:
sudo apt install libasound-dev libportaudio2

Sonra PyAudio kurulumunu tekrar yap.

Yazılım yöneticisinde böyle bir şey buldum. Aynı şey mi yoksa ismi benzer farklı bir şey mi?

 
Eksik kütüphane var. Aşağıdaki komutla kurmayı dene.

Bash:
sudo apt install libasound-dev libportaudio2

Sonra PyAudio kurulumunu tekrar yap.
Kod:
(env) pip install pyaudio
Collecting pyaudio
  Using cached PyAudio-0.2.13.tar.gz (46 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-310/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/src
      creating build/temp.linux-x86_64-cpython-310/src/pyaudio
      x86_64-unknown-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -fPIC -I/usr/local/include -I/usr/include -I/home/mete/Desktop/jarvis/env/include -I/usr/include/python3.10 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-310/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-unknown-linux-gnu-gcc' failed with exit code 1
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
Hala hata veriyor.
 
@cryptonet0 Apt'nin çıktısı neydi? Onu da paylaşın.


Aynısı. Sadece paket yöneticisinin.
Kod:
sudo apt install libasound-dev libportaudio2

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libasound2-dev' instead of 'libasound-dev'
libasound2-dev is already the newest version (1.2.6.1-1ubuntu1).
libportaudio2 is already the newest version (19.6.0-1.1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

İyi aslında onu kurabilir denemediyse.
O kuruluymuş zaten
 
Bulunduğun ortamda kurulu değil.
Kod:
(env) mete@mete-linuxmint:~/Desktop/jarvis$ pip install pyaudio
Requirement already satisfied: pyaudio in ./env/lib/python3.10/site-packages (0.2.13)
Artık kurulu olduğuna eminiz ancak hata aynı.
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…