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
3 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

Please sign in to leave a comment.