kivy: AUDIO SDL2 unable to open mixer while trying to load a sound

Versions

  • Python: 3.6.8
  • OS: Ubuntu 18.04.3 LTS
  • Kivy installation method:
python3 -m pip install kivy
python -m pip install ffpyplayer

Description

I get a audio device error while trying to load a sound on python through kivy audio. I’ve wrote the code in Windows and it runs perfectly, but now i’m trying to run it on an ubuntu machine and it give me this error.

Code and Logs

from kivy.core.audio import SoundLoader
bell = SoundLoader.load('audios/bell.wav')
[INFO   ] [Logger      ] Record log in /home/artotim/.kivy/logs/kivy_19-09-25_10.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "/home/artotim/.local/lib/python3.6/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.6.8 (default, Aug 20 2019, 17:12:48) 
[GCC 8.3.0]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python3"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'3.1 Mesa 19.0.8'>
[INFO   ] [GL          ] OpenGL vendor <b'VMware, Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'llvmpipe (LLVM 8.0, 256 bits)'>
[INFO   ] [GL          ] OpenGL parsed version: 3, 1
[INFO   ] [GL          ] Shading version <b'1.40'>
[INFO   ] [GL          ] Texture max size <8192>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Audio       ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
[INFO   ] [GL          ] NPOT texture support is available
xclip version 0.12
Copyright (C) 2001-2008 Kim Saunders et al.
Distributed under the terms of the GNU GPL
[INFO   ] [Clipboard   ] Provider: xclip
[INFO   ] [CutBuffer   ] cut buffer support enabled
[CRITICAL] [AudioSDL2   ] Unable to open mixer: b'No such audio device'
[WARNING] Deprecated property "<AliasProperty name=filename>" of object "<kivy.core.audio.audio_sdl2.SoundSDL2 object at 0x7faa1eb3ead8>" was accessed, it will be removed in a future version
[WARNING] [AudioSDL2   ] Unable to load /home/artotim/Desktop/fighterapp/audios/bell.wav: b"Audio device hasn't been opened"

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 20 (11 by maintainers)

Most upvoted comments

I solved this on debian by installing all the kivy dependencies:

sudo apt-get install python-pip build-essential git python python-dev ffmpeg libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev zlib1g-dev

And then uninstalling kivy

pip uninstall kivy

And reinstalling it, telling pip not to use precompiled wheels:

pip install --no-binary kivy kivy

I solved this on debian by installing all the kivy dependencies:

sudo apt-get install python-pip build-essential git python python-dev ffmpeg libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev zlib1g-dev

And then uninstalling kivy

pip uninstall kivy

And reinstalling it, telling pip not to use precompiled wheels:

pip install --no-binary kivy kivy

Thank you for the trick, it save my day on ubuntu 20.04 with python3.8, kivy 2.0.0 and ffpyplayer 4.3.2

I just copied/added all the --with-XXX-shared=no I found because if e.g. ``XXX` is used by sdl2, you want it to hard link with/include it so that it gets pulled into the manylinux wheel. I think that’s how e.g. pygame did it so I just copied it. For packages not actually present, it should make no difference.