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 GstWith 2026.2.1 I get
TypeError: must be an interface
import gigi.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.
请先登录再写评论。
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
Kind regards,
Thanks.
I did that by invoking pycharm64.exe from within my conda environment instead of the Windows shortcut.
That worked, but why did I not have to do this with PyCharm 2025?
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,
Thank you! Will this bugfix also work with just using the `python console` to do this?
If it just fixes the PATH in the Run/Debug configuration, then something else is wrong.
So I went to find a minimal conda environment to replicate the problem I'm having, and started with
When I added that environment to PyCharm and brought up a Python Console, I found that I could do
However, when I
(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.
Downgrading typing_extensions from 4.16 to 4.14 did not help.
Hi there
Thank you for the additional details, I was able to replicate this using your steps.
This bugfix in PY-91371 will indeed fix also the python console issue you are facing. As you can see part of the issue description is conda not activating in the title which is also the root cause here. Also the Run/Debug fix is a workaround which does not indeed address the python console behavior.
If you try to launch PyCharm 2026.2.1 from an activated conda env terminal you will not see the issue both in python console and when running the script (I confirmed this on my end but please let me know if different outcome on your side)
conda activate pycharm-gst-test & “C:\Users\youruser\AppData\Local\Programs\PyCharm Professional\bin\pycharm64.exe”An additional workaround step which I tested on my end for the python console would be to change the starting script (File | Settings | Python | Console | Python Console) to something like:
import osimport sysfrom pathlib import Path_gst_dll_handle = None_gst_bin = Path(sys.prefix) / "Library" / "bin"if sys.platform == "win32" and _gst_bin.is_dir():_gst_dll_handle = os.add_dll_directory(str(_gst_bin))os.environ["PATH"] = str(_gst_bin) + os.pathsep + os.environ.get("PATH", "")print("Python %s on %s" % (sys.version, sys.platform))sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])Also I verified internally with 2026.3 build (not available yet to public) and the behavior is again restored as in 2025.2
Sorry for the inconvenience of this bug.
Yes!!! That workaround step worked like a charm! Understandably, this doesn't address the same problem I have in the Run/Debug configuration, but I can modify my PATH there as in 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?_gl=1*1h41klb*_gcl_au*MTQ5OTA3NDQwMS4xNzg4NDQxNzY4*FPAU*MTQ5OTA3NDQwMS4xNzg4NDQxNzY4*_ga*MTY4MDkxNTA1MC4xNzg4NDQxNzY2*_ga_9J976DJZ68*czE3ODg0NDE3NjUkbzEkZzEkdDE3ODg0NDE4MTkkajgkbDAkaDA.#workaround
Thanks so much.
Anxiously awaiting update.