Search code examples
pythonlinuxpippyaudioportaudio

Problem with pip in Python3.8 (Ubuntu 19.10)


When I downloaded Ubuntu 19.10, and use pip in install python 3.8, I met this problem. I install some modules, I haven't problem. But trying install Kivy/PyoAudio/PyGame (Maybe it's not full list) was a crash. I In terminal I can see: ERROR: Command errored out with exit status 1.

If anyone knows how fix this problem, please write what should I do.

Example with PyAudio:

ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_wk29gwp/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_wk29gwp/pyaudio/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-ybexxyha/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-_wk29gwp/pyaudio/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
       29 | #include "portaudio.h"
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_wk29gwp/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_wk29gwp/pyaudio/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-ybexxyha/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Example with PyGame:

ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cthrw5_o/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cthrw5_o/pygame/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 /tmp/pip-install-cthrw5_o/pygame/pip-egg-info
         cwd: /tmp/pip-install-cthrw5_o/pygame/
    Complete output (12 lines):


    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using UNIX configuration...

    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found

    Hunting dependencies...
    WARNING: "sdl-config" failed!
    Unable to run "sdl-config". Please make sure a development version of SDL is installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.`   

Solution

  • It requires libsdl library development version installed on your system. More info at https://wiki.libsdl.org/Installation

    But it seems like it should work using this command

    sudo apt-get install libsdl2-2.0
    

    Debian-based systems (including Ubuntu) can simply do "sudo apt-get install libsdl2-2.0" to get the library installed system-wide, and all sorts of other useful dependencies, too.

    Also it looks like portaudio19-dev is required as well for the case (from the stacktrace you posted).

    sudo apt-get install portaudio19-dev