Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14301

How do install gst-python on macOS to work with the recommended GStreamer installers?

$
0
0

I'm trying to get the following to work on macOS 14.4.1 on an M1 Pro:

$ python3Python 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import sys>>> import gi>>> gi.require_version('GLib', '2.0')>>> gi.require_version('GObject', '2.0')>>> gi.require_version('Gst', '1.0')Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/opt/homebrew/lib/python3.12/site-packages/gi/__init__.py", line 126, in require_version    raise ValueError('Namespace %s not available' % namespace)ValueError: Namespace Gst not available

Note:

$ which python3/opt/homebrew/bin/python3

I found this question: Installing gst-python in macOS. It appears I need to install gst-python. I've already installed the 1.24 runtime and development installers of GStreamer--I opted not to use Homebrew after reading the notes there--but apparently gst-python is not installed with it.

In the StackOverflow question@chronosynclastic describes cloning the gstreamer GitLab repository and then building the gst-python subproject, so I tried the same:

$ meson setup builddir -Dpygi-overrides-dir=/opt/homebrew/lib/python3.12/site-packages/gi/overrides && ninja -C builddirThe Meson build systemVersion: 1.4.0Source dir: /Users/dspitzer/dev/from_gitlab/gstreamer/subprojects/gst-pythonBuild dir: /Users/dspitzer/dev/from_gitlab/gstreamer/subprojects/gst-python/builddirBuild type: native buildProject name: gst-pythonProject version: 1.24.1.1C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")C linker for the host machine: cc ld64 1053.12Host machine cpu family: aarch64Host machine cpu: aarch64Found pkg-config: YES (/Library/Frameworks/GStreamer.framework/Versions/1.0/bin/pkg-config) 0.29.2Run-time dependency gstreamer-1.0 found: YES 1.24.1Run-time dependency gstreamer-base-1.0 found: YES 1.24.1Run-time dependency gmodule-no-export-2.0 found: YES 2.74.4Library dl found: YESFound CMake: /opt/homebrew/bin/cmake (3.29.1)Run-time dependency pygobject-3.0 found: NO (tried pkgconfig, framework and cmake)Looking for a fallback subproject for the dependency pygobject-3.0meson.build:26:16: ERROR: Neither a subproject directory nor a pygobject.wrap file was found.A full log can be found at /Users/dspitzer/dev/from_gitlab/gstreamer/subprojects/gst-python/builddir/meson-logs/meson-log.txt

But I can't figure out how to fix "Run-time dependency pygobject-3.0 found: NO".

Note:l'L'l's comment pointed out that the pip3 command above is using a different version of Python. I fixed that--so you can skip to "Update" below.

I found this StackOverflow answer (and comment) and successfully ran brew install pygobject3 gtk+3 but:

$ pip3 install pygobjectCollecting pygobject  Using cached pygobject-3.48.1.tar.gz (714 kB)  Installing build dependencies ... done  Getting requirements to build wheel ... done  Preparing metadata (pyproject.toml) ... error  error: subprocess-exited-with-error× Preparing metadata (pyproject.toml) did not run successfully.│ exit code: 1╰─> [23 lines of output]+ meson setup /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-thqb1k2v/pygobject_ad81b1b46af0427a953b312d45c6e129 /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-thqb1k2v/pygobject_ad81b1b46af0427a953b312d45c6e129/.mesonpy-aial33lr -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dtests=false -Dwheel=true --wrap-mode=nofallback --native-file=/private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-thqb1k2v/pygobject_ad81b1b46af0427a953b312d45c6e129/.mesonpy-aial33lr/meson-python-native-file.ini      The Meson build system      Version: 1.4.0      Source dir: /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-thqb1k2v/pygobject_ad81b1b46af0427a953b312d45c6e129      Build dir: /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-thqb1k2v/pygobject_ad81b1b46af0427a953b312d45c6e129/.mesonpy-aial33lr      Build type: native build      Project name: pygobject      Project version: 3.48.1      C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")      C linker for the host machine: cc ld64 1053.12      Host machine cpu family: aarch64      Host machine cpu: aarch64      Program python3 found: YES (/Users/dspitzer/.new_local/share/pyenv/versions/3.11.7/bin/python3.11)      Found pkg-config: YES (/Library/Frameworks/GStreamer.framework/Commands/pkg-config) 0.29.2      Run-time dependency python found: YES 3.11      Found CMake: /opt/homebrew/bin/cmake (3.29.1)      Run-time dependency gobject-introspection-1.0 found: NO (tried pkgconfig, framework and cmake)      Not looking for a fallback subproject for the dependency gobject-introspection-1.0 because:      Use of fallback dependencies is disabled.      ../meson.build:29:9: ERROR: Dependency 'gobject-introspection-1.0' is required but not found.      A full log can be found at /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-thqb1k2v/pygobject_ad81b1b46af0427a953b312d45c6e129/.mesonpy-aial33lr/meson-logs/meson-log.txt      [end of output]  note: This error originates from a subprocess, and is likely not a problem with pip.error: metadata-generation-failed× Encountered error while generating package metadata.╰─> See above for output.note: This is an issue with the package mentioned above, not pip.hint: See above for details.

Update: I had added $HOME/.new_local/bin (created by the GStreamer install) to my PATH, in front of /opt/homebrew/bin so pip3 was running the one in the former which resulted in a different version of Python.

So I fixed the path and reran:

$ pip3 install pygobjectCollecting pygobject  Downloading pygobject-3.48.2.tar.gz (715 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 715.2/715.2 kB 13.3 MB/s eta 0:00:00  Installing build dependencies ... done  Getting requirements to build wheel ... done  Preparing metadata (pyproject.toml) ... error  error: subprocess-exited-with-error× Preparing metadata (pyproject.toml) did not run successfully.│ exit code: 1╰─> [23 lines of output]+ meson setup /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-i7tjs1ue/pygobject_d272551047184d069c19b9453f89f97d /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-i7tjs1ue/pygobject_d272551047184d069c19b9453f89f97d/.mesonpy-rhycpxqs -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dtests=false -Dwheel=true --wrap-mode=nofallback --native-file=/private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-i7tjs1ue/pygobject_d272551047184d069c19b9453f89f97d/.mesonpy-rhycpxqs/meson-python-native-file.ini      The Meson build system      Version: 1.4.0      Source dir: /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-i7tjs1ue/pygobject_d272551047184d069c19b9453f89f97d      Build dir: /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-i7tjs1ue/pygobject_d272551047184d069c19b9453f89f97d/.mesonpy-rhycpxqs      Build type: native build      Project name: pygobject      Project version: 3.48.2      C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")      C linker for the host machine: cc ld64 1053.12      Host machine cpu family: aarch64      Host machine cpu: aarch64      Program python3 found: YES (/Users/dspitzer/dev/python/dashboard-fake-frontend/env/bin/python3.12)      Found pkg-config: YES (/Library/Frameworks/GStreamer.framework/Versions/1.0/bin/pkg-config) 0.29.2      Run-time dependency python found: YES 3.12      Found CMake: /opt/homebrew/bin/cmake (3.29.1)      Run-time dependency gobject-introspection-1.0 found: NO (tried pkgconfig, framework and cmake)      Not looking for a fallback subproject for the dependency gobject-introspection-1.0 because:      Use of fallback dependencies is disabled.      ../meson.build:29:9: ERROR: Dependency 'gobject-introspection-1.0' is required but not found.      A full log can be found at /private/var/folders/sb/329vdstd77q73c_7j_smp9r40000gp/T/pip-install-i7tjs1ue/pygobject_d272551047184d069c19b9453f89f97d/.mesonpy-rhycpxqs/meson-logs/meson-log.txt      [end of output]  note: This error originates from a subprocess, and is likely not a problem with pip.error: metadata-generation-failed× Encountered error while generating package metadata.╰─> See above for output.note: This is an issue with the package mentioned above, not pip.hint: See above for details.

So the Python version wasn't the issue.

Now I'm stuck here.


Viewing all articles
Browse latest Browse all 14301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>