Xpra: Ticket #1181: PyGIWarning: Gst was imported without specifying a version first

When starting an Xpra server, I see the following warning:

sys:1: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded.

Thu, 21 Apr 2016 12:12:10 GMT - Antoine Martin: owner changed

The only location where we import the gstreamer 1.x bindings (aka "Gst") in the whole source tree is found here: browser/xpra/tags/v0.17.x/src/xpra/sound/gstreamer_util.py and looks like this:

    import gi
    log("import_gst1() gi=%s", gi)
    gi.require_version('Gst', '1.0')
    from gi.repository import Gst           #@UnresolvedImport
    log("import_gst1() Gst=%s", Gst)

And I have never seen this warning since the require_version line has been added a long time ago.

What distro and version are you running on? Maybe you want to run with -d sound,gstreamer or even -d all to find out where this is happening.

Thu, 21 Apr 2016 12:36:22 GMT - urzds:

Full Xpra output (minus XServer output):

2016-04-21 11:34:41,369 created unix domain socket: /home/xpra/.xpra/xpra-test-100
2016-04-21 11:34:46,379 PyOpenCL loaded, header version: 1.2, GL support: True
2016-04-21 11:34:46,380 OpenCL Error: failed to find a working platform and device combination... trying with pyopencl's 'create_some_context'
2016-04-21 11:34:46,380  cannot load csc_opencl (OpenCL colorspace conversion): ColorspaceConverter missing from xpra.codecs.csc_opencl.colorspace_converter
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/loader.py", line 64, in codec_import_check
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/csc_opencl/colorspace_converter.py", line 868, in selftest
    testcsc(colorspace_converter, full)
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/codec_checks.py", line 224, in testcsc
    return do_testcsc(csc_module, W, H, full, test_cs_in, test_cs_out)
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/codec_checks.py", line 252, in do_testcsc
    cs_in_list = csc_module.get_input_colorspaces()
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/csc_opencl/colorspace_converter.py", line 518, in get_input_colorspaces
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/csc_opencl/colorspace_converter.py", line 427, in build_kernels
  File "/usr/lib64/python2.7/site-packages/xpra/codecs/csc_opencl/colorspace_converter.py", line 175, in select_device
    context = pyopencl.create_some_context(interactive=False)
  File "/usr/lib64/python2.7/site-packages/pyopencl/__init__.py", line 1310, in create_some_context
    raise Error("no devices found")
Error: no devices found
2016-04-21 11:34:51,936 Warning: webcam forwarding is disabled
2016-04-21 11:34:51,936  the virtual video directory '/sys/devices/virtual/video4linux' was not found
2016-04-21 11:34:51,937  make sure that the 'v4l2loopback' kernel module is installed and loaded
2016-04-21 11:34:51,937 found 0 virtual video devices
sys:1: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded.
2016-04-21 11:34:52,898 GStreamer version 1.8 for Python 2.7
2016-04-21 11:34:53,142 D-Bus notification forwarding is available
2016-04-21 11:34:53,647 started command 'xterm' with pid 115
2016-04-21 11:34:53,648 xpra X11 version 0.17.0-r12447
2016-04-21 11:34:53,648  running with pid 1 on Linux Fedora 25 Rawhide
2016-04-21 11:34:53,648  on display :100
2016-04-21 11:34:54,146 xpra is ready.
2016-04-21 11:34:54,239 Error: lpinfo command failed to run
2016-04-21 11:34:54,240  [Errno 2] No such file or directory
2016-04-21 11:34:54,241  command used: '/usr/sbin/lpinfo --make-and-model Generic PDF Printer -m'
2016-04-21 11:34:54,635 Error: lpinfo command failed to run
2016-04-21 11:34:54,635  [Errno 2] No such file or directory
2016-04-21 11:34:54,636  command used: '/usr/sbin/lpinfo --make-and-model Generic PostScript Printer -m'
2016-04-21 11:34:54,636 Warning: no printer definitions found, cannot enable printing

Thu, 21 Apr 2016 13:08:50 GMT - Antoine Martin:

Full Xpra output

I would need the debug output to figure out when this is firing. Or better yet, you can just run xpra/sound/gstreamer_util.py -v, it will probably fire the warning and show that it is bogus. Maybe a rawhide bug.

BTW, for a cleaner server startup:

Fri, 22 Apr 2016 18:15:14 GMT - urzds:

With -d sound,gstreamer:

trying to import GStreamer 1.0 using <function import_gst1 at 0x7f29e4e2bde8>
import_gst1() gi=<module 'gi' from '/usr/lib64/python2.7/site-packages/gi/__init__.pyc'>
import_gst1() Gst=<GstProxyModule <IntrospectionModule 'Gst' from '/usr/lib64/girepository-1.0/Gst-1.0.typelib'>>
sys:1: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded.
Python GStreamer version 1.8.0 for Python 2.7

Output of xpra/sound/gstreamer_util.py -v:

sh-4.3# python2.7 /usr/lib64/python2.7/site-packages/xpra/sound/gstreamer_util.py -v
GStreamer 1.0 environment: {'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'}
GStreamer 1.0 sys.path=/usr/lib64/python2.7/site-packages/xpra/sound, /usr/lib64/python27.zip, /usr/lib64/python2.7, /usr/lib64/python2.7/plat-linux2, /usr/lib64/python2.7/lib-tk, /usr/lib64/python2.7/lib-old, /usr/lib64/python2.7/lib-dynload, /usr/lib64/python2.7/site-pac
kages, /usr/lib64/python2.7/site-packages/Numeric, /usr/lib64/python2.7/site-packages/gtk-2.0, /usr/lib/python2.7/site-packages
trying to import GStreamer 1.0 using <function import_gst1 at 0x7fe3d6b5b050>
import_gst1() gi=<module 'gi' from '/usr/lib64/python2.7/site-packages/gi/__init__.pyc'>
import_gst1() Gst=<GstProxyModule <IntrospectionModule 'Gst' from '/usr/lib64/girepository-1.0/Gst-1.0.typelib'>>
sys:1: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded.
Python GStreamer version 1.8.0 for Python 2.7
Loaded Python GStreamer version 1.8.0 for Python 2.7
found the following plugins: ['3gppmux', 'aacparse', 'ac3parse', 'adder', 'agingtv', 'alawdec', 'alawenc', 'alpha', 'alphacolor', 'alsamidisrc', 'alsasink', 'alsasrc', 'amrparse', 'apedemux', 'apev2mux', 'appsink', 'appsrc', 'aspectratiocrop', 'asteriskh263', 'audioamplify
', 'audiochebband', 'audiocheblimit', 'audioconvert', 'audiodynamic', 'audioecho', 'audiofirfilter', 'audioiirfilter', 'audioinvert', 'audiokaraoke', 'audiopanorama', 'audiorate', 'audioresample', 'audiotestsrc', 'audiowsincband', 'audiowsinclimit', 'auparse', 'autoaudiosi
nk', 'autoaudiosrc', 'autovideosink', 'autovideosrc', 'avidemux', 'avimux', 'avisubtitle', 'bin', 'breakmydata', 'capsfilter', 'capssetter', 'cdparanoiasrc', 'clockoverlay', 'concat', 'cpureport', 'cutter', 'dcaparse', 'decodebin', 'deinterlace', 'deinterleave', 'dicetv',
'downloadbuffer', 'dtmfsrc', 'dv1394src', 'dvdec', 'dvdemux', 'dynudpsink', 'edgetv', 'encodebin', 'equalizer-10bands', 'equalizer-3bands', 'equalizer-nbands', 'fakesink', 'fakesrc', 'fdsink', 'fdsrc', 'filesink', 'filesrc', 'flacdec', 'flacenc', 'flacparse', 'flactag', 'f
lvdemux', 'flvmux', 'flxdec', 'funnel', 'gamma', 'gdkpixbufdec', 'gdkpixbufoverlay', 'gdkpixbufsink', 'giosink', 'giosrc', 'giostreamsink', 'giostreamsrc', 'goom', 'goom2k1', 'hdv1394src', 'icydemux', 'id3demux', 'id3v2mux', 'identity', 'imagefreeze', 'input-selector', 'in
terleave', 'ismlmux', 'jpegdec', 'jpegenc', 'level', 'matroskademux', 'matroskamux', 'matroskaparse', 'mj2mux', 'mp4mux', 'mpegaudioparse', 'mulawdec', 'mulawenc', 'multifdsink', 'multifilesink', 'multifilesrc', 'multipartdemux', 'multipartmux', 'multiqueue', 'multisockets
ink', 'multiudpsink', 'navigationtest', 'navseek', 'oggaviparse', 'oggdemux', 'oggmux', 'oggparse', 'ogmaudioparse', 'ogmtextparse', 'ogmvideoparse', 'optv', 'opusdec', 'opusenc', 'oss4sink', 'oss4src', 'osssink', 'osssrc', 'output-selector', 'pipeline', 'playbin', 'playsi
nk', 'pngdec', 'pngenc', 'progressreport', 'pulsesink', 'pulsesrc', 'pushfilesrc', 'qtdemux', 'qtmoovrecover', 'qtmux', 'quarktv', 'queue', 'queue2', 'radioactv', 'revtv', 'rganalysis', 'rglimiter', 'rgvolume', 'rippletv', 'rndbuffersize', 'rtpL16depay', 'rtpL16pay', 'rtpL
24depay', 'rtpL24pay', 'rtpac3depay', 'rtpac3pay', 'rtpamrdepay', 'rtpamrpay', 'rtpbin', 'rtpbvdepay', 'rtpbvpay', 'rtpceltdepay', 'rtpceltpay', 'rtpdec', 'rtpdtmfdepay', 'rtpdtmfmux', 'rtpdtmfsrc', 'rtpdvdepay', 'rtpdvpay', 'rtpg722depay', 'rtpg722pay', 'rtpg723depay', 'r
tpg723pay', 'rtpg726depay', 'rtpg726pay', 'rtpg729depay', 'rtpg729pay', 'rtpgsmdepay', 'rtpgsmpay', 'rtpgstdepay', 'rtpgstpay', 'rtph261depay', 'rtph261pay', 'rtph263depay', 'rtph263pay', 'rtph263pdepay', 'rtph263ppay', 'rtph264depay', 'rtph264pay', 'rtph265depay', 'rtph26
5pay', 'rtpilbcdepay', 'rtpilbcpay', 'rtpj2kdepay', 'rtpj2kpay', 'rtpjitterbuffer', 'rtpjpegdepay', 'rtpjpegpay', 'rtpklvdepay', 'rtpklvpay', 'rtpmp1sdepay', 'rtpmp2tdepay', 'rtpmp2tpay', 'rtpmp4adepay', 'rtpmp4apay', 'rtpmp4gdepay', 'rtpmp4gpay', 'rtpmp4vdepay', 'rtpmp4vp
ay', 'rtpmpadepay', 'rtpmpapay', 'rtpmparobustdepay', 'rtpmpvdepay', 'rtpmpvpay', 'rtpmux', 'rtpopusdepay', 'rtpopuspay', 'rtppcmadepay', 'rtppcmapay', 'rtppcmudepay', 'rtppcmupay', 'rtpptdemux', 'rtpqcelpdepay', 'rtpqdm2depay', 'rtprtxqueue', 'rtprtxreceive', 'rtprtxsend'
, 'rtpsbcdepay', 'rtpsbcpay', 'rtpsession', 'rtpsirendepay', 'rtpsirenpay', 'rtpspeexdepay', 'rtpspeexpay', 'rtpssrcdemux', 'rtpstreamdepay', 'rtpstreampay', 'rtpsv3vdepay', 'rtptheoradepay', 'rtptheorapay', 'rtpvorbisdepay', 'rtpvorbispay', 'rtpvp8depay', 'rtpvp8pay', 'rt
pvp9depay', 'rtpvp9pay', 'rtpvrawdepay', 'rtpvrawpay', 'rtpxqtdepay', 'rtspsrc', 'sbcparse', 'scaletempo', 'shagadelictv', 'shapewipe', 'shout2send', 'smpte', 'smptealpha', 'socketsrc', 'souphttpclientsink', 'souphttpsrc', 'spectrum', 'speexdec', 'speexenc', 'splitfilesrc'
, 'splitmuxsink', 'splitmuxsrc', 'ssaparse', 'streaktv', 'streamiddemux', 'streamsynchronizer', 'subparse', 'subtitleoverlay', 'taginject', 'tcpclientsink', 'tcpclientsrc', 'tcpserversink', 'tcpserversrc', 'tee', 'testsink', 'textoverlay', 'textrender', 'theoradec', 'theor
aenc', 'theoraparse', 'timeoverlay', 'typefind', 'udpsink', 'udpsrc', 'uridecodebin', 'v4l2radio', 'v4l2sink', 'v4l2src', 'valve', 'vertigotv', 'videobalance', 'videobox', 'videoconvert', 'videocrop', 'videoflip', 'videomedian', 'videomixer', 'videorate', 'videoscale', 'vi
deotestsrc', 'volume', 'vorbisdec', 'vorbisenc', 'vorbisparse', 'vorbistag', 'vp8dec', 'vp8enc', 'vp9dec', 'vp9enc', 'warptv', 'wavenc', 'wavpackdec', 'wavpackenc', 'wavpackparse', 'wavparse', 'webmmux', 'ximagesink', 'ximagesrc', 'xvimagesink', 'y4menc']
GStreamer plugins found: 3gppmux, aacparse, ac3parse, adder, agingtv, alawdec, alawenc, alpha, alphacolor, alsamidisrc, alsasink, alsasrc, amrparse, apedemux, apev2mux, appsink, appsrc, aspectratiocrop, asteriskh263, audioamplify, audiochebband, audiocheblimit, audioconver
t, audiodynamic, audioecho, audiofirfilter, audioiirfilter, audioinvert, audiokaraoke, audiopanorama, audiorate, audioresample, audiotestsrc, audiowsincband, audiowsinclimit, auparse, autoaudiosink, autoaudiosrc, autovideosink, autovideosrc, avidemux, avimux, avisubtitle,
bin, breakmydata, capsfilter, capssetter, cdparanoiasrc, clockoverlay, concat, cpureport, cutter, dcaparse, decodebin, deinterlace, deinterleave, dicetv, downloadbuffer, dtmfsrc, dv1394src, dvdec, dvdemux, dynudpsink, edgetv, encodebin, equalizer-10bands, equalizer-3bands,
 equalizer-nbands, fakesink, fakesrc, fdsink, fdsrc, filesink, filesrc, flacdec, flacenc, flacparse, flactag, flvdemux, flvmux, flxdec, funnel, gamma, gdkpixbufdec, gdkpixbufoverlay, gdkpixbufsink, giosink, giosrc, giostreamsink, giostreamsrc, goom, goom2k1, hdv1394src, ic
ydemux, id3demux, id3v2mux, identity, imagefreeze, input-selector, interleave, ismlmux, jpegdec, jpegenc, level, matroskademux, matroskamux, matroskaparse, mj2mux, mp4mux, mpegaudioparse, mulawdec, mulawenc, multifdsink, multifilesink, multifilesrc, multipartdemux, multipa
rtmux, multiqueue, multisocketsink, multiudpsink, navigationtest, navseek, oggaviparse, oggdemux, oggmux, oggparse, ogmaudioparse, ogmtextparse, ogmvideoparse, optv, opusdec, opusenc, oss4sink, oss4src, osssink, osssrc, output-selector, pipeline, playbin, playsink, pngdec,
 pngenc, progressreport, pulsesink, pulsesrc, pushfilesrc, qtdemux, qtmoovrecover, qtmux, quarktv, queue, queue2, radioactv, revtv, rganalysis, rglimiter, rgvolume, rippletv, rndbuffersize, rtpL16depay, rtpL16pay, rtpL24depay, rtpL24pay, rtpac3depay, rtpac3pay, rtpamrdepay
, rtpamrpay, rtpbin, rtpbvdepay, rtpbvpay, rtpceltdepay, rtpceltpay, rtpdec, rtpdtmfdepay, rtpdtmfmux, rtpdtmfsrc, rtpdvdepay, rtpdvpay, rtpg722depay, rtpg722pay, rtpg723depay, rtpg723pay, rtpg726depay, rtpg726pay, rtpg729depay, rtpg729pay, rtpgsmdepay, rtpgsmpay, rtpgstde
pay, rtpgstpay, rtph261depay, rtph261pay, rtph263depay, rtph263pay, rtph263pdepay, rtph263ppay, rtph264depay, rtph264pay, rtph265depay, rtph265pay, rtpilbcdepay, rtpilbcpay, rtpj2kdepay, rtpj2kpay, rtpjitterbuffer, rtpjpegdepay, rtpjpegpay, rtpklvdepay, rtpklvpay, rtpmp1sd
epay, rtpmp2tdepay, rtpmp2tpay, rtpmp4adepay, rtpmp4apay, rtpmp4gdepay, rtpmp4gpay, rtpmp4vdepay, rtpmp4vpay, rtpmpadepay, rtpmpapay, rtpmparobustdepay, rtpmpvdepay, rtpmpvpay, rtpmux, rtpopusdepay, rtpopuspay, rtppcmadepay, rtppcmapay, rtppcmudepay, rtppcmupay, rtpptdemux
, rtpqcelpdepay, rtpqdm2depay, rtprtxqueue, rtprtxreceive, rtprtxsend, rtpsbcdepay, rtpsbcpay, rtpsession, rtpsirendepay, rtpsirenpay, rtpspeexdepay, rtpspeexpay, rtpssrcdemux, rtpstreamdepay, rtpstreampay, rtpsv3vdepay, rtptheoradepay, rtptheorapay, rtpvorbisdepay, rtpvor
bispay, rtpvp8depay, rtpvp8pay, rtpvp9depay, rtpvp9pay, rtpvrawdepay, rtpvrawpay, rtpxqtdepay, rtspsrc, sbcparse, scaletempo, shagadelictv, shapewipe, shout2send, smpte, smptealpha, socketsrc, souphttpclientsink, souphttpsrc, spectrum, speexdec, speexenc, splitfilesrc, spl
itmuxsink, splitmuxsrc, ssaparse, streaktv, streamiddemux, streamsynchronizer, subparse, subtitleoverlay, taginject, tcpclientsink, tcpclientsrc, tcpserversink, tcpserversrc, tee, testsink, textoverlay, textrender, theoradec, theoraenc, theoraparse, timeoverlay, typefind,
udpsink, udpsrc, uridecodebin, v4l2radio, v4l2sink, v4l2src, valve, vertigotv, videobalance, videobox, videoconvert, videocrop, videoflip, videomedian, videomixer, videorate, videoscale, videotestsrc, volume, vorbisdec, vorbisenc, vorbisparse, vorbistag, vp8dec, vp8enc, vp
9dec, vp9enc, warptv, wavenc, wavpackdec, wavpackenc, wavpackparse, wavparse, webmmux, ximagesink, ximagesrc, xvimagesink, y4menc
GStreamer version:
PyGStreamer version: 3.20.0
missing ['gdppay', 'gdpdepay'] from ('vorbisenc', 'gdppay', 'vorbisdec', 'gdpdepay')
skipping flac with GStreamer 1.x to avoid obscure 'not-negotiated' errors I do not have time for
missing ['gdppay', 'gdpdepay'] from ('flacenc', 'gdppay', 'flacparse ! flacdec', 'gdpdepay')
missing ['lamemp3enc', 'mad', 'mp3parse'] from ('lamemp3enc', None, 'mad', 'mp3parse')
missing ['lamemp3enc', 'mad'] from ('lamemp3enc', None, 'mad', 'mpegaudioparse')
avoiding opus+gdp with gstreamer version (major=1L, minor=8L, micro=0L, nano=0L)
missing ['gdppay', 'gdpdepay'] from ('speexenc', 'gdppay', 'speexdec', 'gdpdepay')
initialized sound codecs:
* opus       : opusenc     , oggmux      , opusdec     , oggdemux
* vorbis+mka : vorbisenc   , webmmux     , vorbisdec   , matroskademux
* wav        : wavenc      , None        , None        , wavparse
* wavpack    : wavpackenc  , None        , wavpackdec  , wavpackparse
* speex      : speexenc    , oggmux      , speexdec    , oggdemux
encoders supported: opus, vorbis+mka, wav, wavpack, speex
decoders supported: opus, vorbis+mka, wav, wavpack, speex
source plugins: pulsesrc, autoaudiosrc, alsasrc, osssrc, oss4src, audiotestsrc
sink plugins: autoaudiosink, pulsesink, alsasink, osssink, oss4sink
default sink: pulsesink

Sat, 23 Apr 2016 03:14:42 GMT - Antoine Martin: status changed; resolution set

Closing as invalid: this warning is bogus, it shows up straight after import_gst1 which does the required version call. Also it doesn't fire on any other distro, and they all have the same checks - which is why that check is there in the first place.

Sat, 23 Jan 2021 05:17:11 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1181