PyCharm 2026 error when trying to import Gstreamer Python bindings (gi.repository Gst)

Hi.

I have a conda environment with Gstreamer packages installed. In particular gst-python and pygobject. With the lastest version of PyCharm, something broke. With PyCharm 2025.3.6.1, I could do the following:

import gi
gi.require_version('Gst','1.0')
from gi.repository import Gst

With 2026.2.1 I get 

TypeError: must be an interface
 

import gi
gi.require_version('Gst','1.0')
from gi.repository import Gst
(process:6304): GLib-GIRepository-WARNING **: 13:27:41.780: Failed to load shared library 'gstreamer-1.0-0.dll' referenced by the typelib: 'gstreamer-1.0-0.dll': The specified module could not be found.
Traceback (most recent call last):
 File "<input>", line 1, in <module>
 File "C:\Users\tjand\PyCharm 2026.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
   module = self._system_import(name, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
 File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 921, in _load_unlocked
 File "<frozen importlib._bootstrap>", line 813, in module_from_spec
 File "C:\Users\tjand\miniconda3\envs\gst-env\Lib\site-packages\gi\importer.py", line 145, in create_module
   return load_overrides(introspection_module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\tjand\miniconda3\envs\gst-env\Lib\site-packages\gi\overrides\__init__.py", line 128, in load_overrides
   override_mod = importlib.import_module(override_package_name)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\tjand\miniconda3\envs\gst-env\Lib\importlib\__init__.py", line 90, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\tjand\miniconda3\envs\gst-env\Lib\site-packages\gi\overrides\Gst.py", line 93, in <module>
   class URIHandler(Gst.URIHandler):
                    ^^^^^^^^^^^^^^
 File "C:\Users\tjand\miniconda3\envs\gst-env\Lib\site-packages\gi\module.py", line 197, in __getattr__
   wrapper = metaclass(name, bases, dict_)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\tjand\miniconda3\envs\gst-env\Lib\site-packages\gi\types.py", line 266, in __init__
   register_interface_info(cls.__info__.get_g_type())
TypeError: must be an interface
 

If I run Python from a terminal (in PyCharm), I can do the import, but if I try to run my program, I get the TypeError exception. I have found that if I run my program from within VSCode, I get that exception once, but it runs after that.

What changed?

Thanks for any help.

0
6 comments

Hi there

 

Would you please try the workaround mentioned in https://youtrack.jetbrains.com/issue/PY-91371/Run-Debug-with-conda-interpreter-fails-with-exit-code-1066598273-0xC06D007F-conda-activation-not-applied#workaround

Add the conda environment directories to PATH in the Run/Debug configuration's environment variables:

PATH=C:\Users\user\miniconda3\envs\<env>;C:\Users\user\miniconda3\envs\<env>\Library\bin;C:\Users\user\miniconda3\envs\<env>\Library\usr\bin;C:\Users\user\miniconda3\envs\<env>\Scripts;%PATH%

 


Kind regards,

 

0

Thanks.

I did that by invoking pycharm64.exe from within my conda environment instead of the Windows shortcut.

"C:\Program Files\JetBrains\PyCharm 2026.2.1\bin\pycharm64.exe"

That worked, but why did I not have to do this with PyCharm 2025?

0

Hi there

 

Unfortunately this is a bug/regression introduced with 2026.2

The bug is already fixed (in https://youtrack.jetbrains.com/issue/PY-91371)  and will be available with PyCharm 2026.3.0 (or EAP release as soon they are available)

 

Kind regards,

0

Thank you! Will this bugfix also work with just using the `python console`  to do this?

import gi
gi.require_version('Gst','1.0')
from gi.repository import Gst

If it just fixes the PATH in the Run/Debug configuration, then something else is wrong.

0

So I went to find a minimal conda environment to replicate the problem I'm having, and started with

conda create -n pycharm-gst-test gstreamer pygobject

When I added that environment to PyCharm and brought up a Python Console, I found that I could do

import gi
gi.require_version('Gst','1.0')
from gi.repository import Gst

However, when I 

conda install gst-python

(which also installs gst-plugins-base, gst-plugins-bad, among other packages), that breaks and I get the TypeError exception. Backing up a bit, I uninstalled gst-python (which then uninstalled gst-plugins-base, gst-plugins-bad) so I added those back in one at a time and it looks like my culprit may be the typing_extensions package. 

Still, this all worked with PyCharm 2025.

0

Downgrading typing_extensions from 4.16 to 4.14 did not help. 

0

Please sign in to leave a comment.