playsound icon indicating copy to clipboard operation
playsound copied to clipboard

Attempting to use on Rasberry Pi 3: ValueError: Namespace Gst not available

Open seanspotatobusiness opened this issue 7 years ago • 11 comments

I have a Rasberry Pi 3 running Raspbian GNU/Linux 9 (stretch).

I get the following error after installing playsound and trying to test following the instructions here: https://pypi.org/project/playsound/

pi@raspberrypi:~/Desktop $ python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    playsound('./Desktop/DEFCON level change.mp3')
  File "/home/pi/.local/lib/python2.7/site-packages/playsound.py", line 92, in _playsoundNix
    gi.require_version('Gst', '1.0')
  File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 118, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
pi@raspberrypi:~/Desktop $ 

seanspotatobusiness avatar May 12 '18 15:05 seanspotatobusiness

I also have a Pi 3 running Raspian. I’d be happy to test and accept any pull requests to fix it.

(I’m not a very good BDFL.)

Taylor

On May 12, 2018, at 11:51, seanspotatobusiness [email protected] wrote:

I have a Rasberry Pi 3 running Raspbian GNU/Linux 9 (stretch).

I get the following error after installing playsound and trying to test following the instructions here: https://pypi.org/project/playsound/

pi@raspberrypi:/Desktop $ python test.py Traceback (most recent call last): File "test.py", line 2, in playsound('./Desktop/DEFCON level change.mp3') File "/home/pi/.local/lib/python2.7/site-packages/playsound.py", line 92, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python2.7/dist-packages/gi/init.py", line 118, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Gst not available pi@raspberrypi:/Desktop $

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

TaylorSMarks avatar May 12 '18 16:05 TaylorSMarks

any update i'm still getting the same error?

omi10859 avatar Mar 01 '19 05:03 omi10859

Testing on Raspberry Pi 3 B+ model and have just 2 lines in py code. Python version 3.5.3

from playsound import playsound playsound("alarm.wav")

I get error below even after installing packages "gst-make", "gstreamer-player", "fisspy" and "pgi" on Thonny IDE. Any help will be truly appreciated. If there is an alternate package for sound to be emitted that would work as well. Thanks in advance!

Traceback (most recent call last): File "sound.py", line 3, in <module> playsound("home/pi/alarm.wav") File "/home/pi/.local/lib/python3.5/site-packages/playsound.py", line 92, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python3/dist-packages/gi/__init__.py", line 118, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Gst not available

paramda-zz avatar Jun 16 '19 16:06 paramda-zz

@TaylorSMarks , after going through several posts, looks like playsound doesn't work on Raspbian. Found working code at https://raspberrypi.stackexchange.com/questions/7088/playing-audio-files-with-python

import pygame pygame.mixer.init() pygame.mixer.music.load("myFile.wav") pygame.mixer.music.play() while pygame.mixer.music.get_busy() == True: continue

Any timeline for fixing playsound? :) I like the simplicity aspect.

paramda-zz avatar Jun 16 '19 19:06 paramda-zz

Any working solutions yet?

I have a pi 4 and getting the same thing... I really wanna use playsound.

File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/playsound.py", line 92, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python2.7/dist-packages/gi/init.py", line 129, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Gst not available

Vexxlol avatar Jul 03 '20 10:07 Vexxlol

I use pi 3 and get wrong

vovantamvn avatar Jul 03 '20 15:07 vovantamvn

GStreamer Python bindings are missing. Install them by either:

  • Python 2: sudo apt install python-gst-1.0
  • Python 3: sudo apt install python3-gst-1.0

gsilvan avatar Jul 14 '20 13:07 gsilvan

If it’s often that easy to fix, it should be made to display a message saying to do so, or it should just automatically take care of it.

Alternatively, can playsound’s linux portion be made to do whatever GStreamer’s Python bindings do, if there’s just some small part needed from it?

Sent from my iPhone

On Jul 14, 2020, at 09:34, gsilvan [email protected] wrote:

 GStreamer Python bindings are missing. Install them by either:

Python 2: sudo apt install python-gst-1.0 Python 3: sudo apt install python3-gst-1.0 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

TaylorSMarks avatar Jul 14 '20 17:07 TaylorSMarks

Fixed for me after installing gst-python, though now it freezes lmao

ar1ja avatar Nov 27 '21 14:11 ar1ja

Fixed for me after installing gst-python, though now it freezes lmao

Did you ever figure out a fix around the freezing? I tried installing gst-python and it didn't fix the sound issue, but now my program freezes haha.

Lito-Frito avatar May 19 '22 18:05 Lito-Frito

GStreamer Python bindings are missing. Install them by either:

* **Python 2:** `sudo apt install python-gst-1.0`

* **Python 3:** `sudo apt install python3-gst-1.0`

It seems that, at least for Python 3, we only need to run sudo apt install gir1.2-gstreamer-1.0

yangshengtian avatar Jul 22 '24 06:07 yangshengtian