Python3 Error with PyGobject

When I run a program using PyGobject, I get a Namespace Gst not available error. I found that you can fix this by doing sudo apt install python3-gst-1.0, but I cannot find the correct/similar file for Manjaro/Arch. Any ideas would be great, I’m trying to use the playsound module which then calls gi (pyobject) but it has that error. This is all being run in a Jupyter Notebook with Anaconda to hold the modules.
Thank you

# TEST: Test shorter MFCC
!pip install playsound
from playsound import playsound

idx = 13

# Create path from given filename and target item
path = join(dataset_path, target_list[int(y_orig_train[idx])], 

# Create MFCCs
mfccs = calc_mfcc(path)
print("MFCCs:", mfccs)

# Plot MFCC
fig = plt.figure()
plt.imshow(mfccs, cmap='inferno', origin='lower')

# TEST: Play problem sounds


ValueError                                Traceback (most recent call last)
<ipython-input-59-9cbeee90ea76> in <module>
     19 # TEST: Play problem sounds
     20 print(target_list[int(y_orig_train[idx])])
---> 21 playsound(path)

~/anaconda3/envs/tensorflow/lib/python3.8/site-packages/ in _playsoundNix(sound, block)
     91     import gi
---> 92     gi.require_version('Gst', '1.0')
     93     from gi.repository import Gst

~/anaconda3/envs/tensorflow/lib/python3.8/site-packages/gi/ in require_version(namespace, version)
    124     available_versions = repository.enumerate_versions(namespace)
    125     if not available_versions:
--> 126         raise ValueError('Namespace %s not available' % namespace)
    128     if version not in available_versions:

ValueError: Namespace Gst not available

The equivalent is gst-python.

Thank you, but that did not solve the issue, I’m still getting the same error. Any ideas as to why?

No, because I have no idea what you’re doing and how your Python environment is setup. If you’re developing, you should be using a virtualenv. That way, you don’t conflict with the system Python path and packages.

1 Like

Well it’s all being ran in a Anaconda environment separate than my base environment. I’m going to mark the equivalent answer as the post answer as the only issue I’m having is with this specific module and I can use a different module for sound with python. I’ll look into using a virtualenv though, thank you.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.