You are not logged in.

#1 2020-10-06 14:32:57

Tom B
Member
Registered: 2014-01-15
Posts: 187
Website

OBS-Studio Scripts not working with Python 3.8

I originally thought this was an OBS issue so reported it there ( https://github.com/obsproject/obs-studio/issues/3565 ).

However, python scripts running from OBS give errors when trying to use any libraries. Am I missing a python package or is it being built wrong?

Error message from OBS:

[url-text.py] Traceback (most recent call last):
[url-text.py]   File "/usr/share/obs/obs-plugins/frontend-tools/scripts/url-text.py", line 2, in <module>
[url-text.py]     import urllib.request
[url-text.py]   File "/usr/lib/python3.8/urllib/request.py", line 84, in <module>
[url-text.py]     import base64
[url-text.py]   File "/usr/lib/python3.8/base64.py", line 10, in <module>
[url-text.py]     import struct
[url-text.py]   File "/usr/lib/python3.8/struct.py", line 13, in <module>
[url-text.py]     from _struct import *
[url-text.py] ImportError: /usr/lib/python3.8/lib-dynload/_struct.cpython-38-x86_64-linux-gnu.so: undefined symbol: _PyFloat_Pack4

Python packages installed:

$ pacman -Q | grep python
python 3.8.5-2
python-acme 1.8.0-1
python-aiohttp 3.6.2-2
python-anytree 2.8.0-1
python-appdirs 1.4.4-1
python-asn1crypto 1.4.0-1
python-async-timeout 3.0.1-3
python-attrs 20.2.0-1
python-automat 20.2.0-2
python-babel 2.8.0-4
python-bcrypt 3.2.0-1
python-beaker 1.11.0-4
python-beautifulsoup4 4.9.2-1
python-cachecontrol 0.12.6-1
python-cached-property 1.5.2-1
python-cairo 1.19.1-1
python-certifi 2020.6.20-1
python-cffi 1.14.3-1
python-chardet 3.0.4-5
python-click 7.1.2-1
python-colorama 0.4.3-1
python-commonmark 0.9.1-1
python-configargparse 1.2.3-1
python-configobj 5.0.6-7
python-constantly 15.1.0-6
python-contextlib2 0.6.0.post1-1
python-cryptography 3.1.1-1
python-cssselect 1.1.0-4
python-dbus 1.2.16-1
python-dbus-common 1.2.16-1
python-distlib 0.3.1-1
python-distro 1.5.0-1
python-docker 4.3.1-1
python-docker-pycreds 0.4.0-5
python-dockerpty 0.4.1-6
python-docopt 0.6.2-7
python-docutils 0.16-1
python-dotenv 0.14.0-1
python-evdev 1.3.0-1
python-future 0.18.2-3
python-geoip 1.3.2-8
python-gobject 3.36.1-1
python-html5lib 1.1-1
python-hyperlink 20.0.1-1
python-idna 2.10-1
python-imagesize 1.2.0-1
python-importlib-metadata 1.6.1-1
python-incremental 17.5.0-4
python-jinja 2.11.2-1
python-josepy 1.4.0-1
python-jsonschema 3.2.0-2
python-lockfile 0.12.2-6
python-lxml 4.5.2-1
python-mako 1.1.3-1
python-markdown 3.2.2-1
python-markupsafe 1.1.1-4
python-mock 3.0.5-3
python-more-itertools 8.5.0-1
python-msgpack 1.0.0-1
python-multidict 4.7.6-1
python-mutagen 1.45.1-1
python-numpy 1.19.2-1
python-opengl 3.1.5-2
python-ordered-set 4.0.2-1
python-packaging 20.4-1
python-paramiko 2.7.2-1
python-parsedatetime 2.6-1
python-pbr 5.5.0-1
python-pep517 0.8.2-1
python-pilkit 2.0-5
python-pillow 7.2.0-1
python-pip 20.1.1-1
python-ply 3.11-5
python-progress 1.5-3
python-pyasn1 0.4.8-2
python-pyasn1-modules 0.2.8-1
python-pycparser 2.20-1
python-pycurl 7.43.0.6-1
python-pygments 2.7.1-1
python-pyhamcrest 1.9.0-5
python-pynacl 1.4.0-1
python-pyopenssl 19.1.0-2
python-pyparsing 2.4.7-1
python-pyqt4 4.12.3-4
python-pyqt5 5.15.1-2
python-pyqt5-sip 12.8.1-1
python-pyqtwebengine 5.15.1-2
python-pyrfc3339 1.1-5
python-pyrsistent 0.17.3-1
python-pytoml 0.1.21-4
python-pytz 2020.1-2
python-pyxdg 0.26-6
python-recommonmark 0.6.0.194.48f9d1a-2
python-rencode 1.0.6-3
python-requests 2.24.0-1
python-requests-toolbelt 0.9.1-3
python-resolvelib 0.4.0-1
python-retrying 1.3.3-7
python-service-identity 18.1.0-4
python-setproctitle 1.1.10-5
python-setuptools 1:50.3.0-1
python-sip-pyqt4 4.19.19-1
python-six 1.15.0-1
python-snowballstemmer 2.0.0-3
python-soupsieve 2.0.1-1
python-sphinx 3.2.1-1
python-sphinx-alabaster-theme 0.7.12-3
python-sphinx_rtd_theme 0.5.0-1
python-sphinxcontrib-applehelp 1.0.2-1
python-sphinxcontrib-devhelp 1.0.2-1
python-sphinxcontrib-htmlhelp 1.0.3-1
python-sphinxcontrib-jsmath 1.0.1-4
python-sphinxcontrib-qthelp 1.0.3-1
python-sphinxcontrib-serializinghtml 1.1.4-1
python-sphinxcontrib-websupport 1.1.2-3
python-sqlalchemy 1.3.19-1
python-texttable 1.6.3-1
python-toml 0.10.1-2
python-twisted 20.3.0-1
python-typing_extensions 3.7.4.3-1
python-unidecode 1.1.1-4
python-urllib3 1.25.10-1
python-vdf 3.3-1
python-webencodings 0.5.1-4
python-websocket-client 0.57.0-1
python-whoosh 2.7.4-5
python-yaml 5.3.1-2
python-yarl 1.5.1-1
python-zipp 3.2.0-1
python-zope-component 4.6.2-1
python-zope-deferredimport 4.3.1-4
python-zope-deprecation 4.4.0-3
python-zope-event 4.5.0-1
python-zope-hookable 5.0.1-1
python-zope-interface 5.1.0-1
python-zope-proxy 4.3.5-1

Offline

#2 2020-10-07 12:43:24

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,177

Re: OBS-Studio Scripts not working with Python 3.8

In python 3.8.6-1 _PyFloat_Pack4 is present in usr/include/python3.8/floatobject.h ,

Does your python 3.8.5-2 install have it also in that file ?

Sidenote :
searching for "undefined symbol something" gives bad results (way to many not related ones) in every search engine I know.
A search for something usually clarifies what something is used for.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2020-10-07 13:30:16

Tom B
Member
Registered: 2014-01-15
Posts: 187
Website

Re: OBS-Studio Scripts not working with Python 3.8

After upgrading I'm on OBS 26.0.0 and Python 3.8.6, the error is the same.

$ cat /usr/include/python3.8/floatobject.h | grep Pack4
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);

It exists, and it works fine if I run a script on the command line using urllib.request, the issue only exists when running Python scripts through OBS.

Last edited by Tom B (2020-10-07 13:32:29)

Offline

#4 2020-10-07 14:54:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,515

Re: OBS-Studio Scripts not working with Python 3.8

https://bbs.archlinux.org/viewtopic.php … 5#p1930175

myself wrote:

_PyFloat_Pack4 is defined in the static /usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a provided by 3.8.5 (and 3.8.6, so you're right in that it's not an issue w/ the partial update), but not in any shared object, so obs (resp. it's python module) would have to be statically linked against that lib (no idea whether that's an option) or the function moved into a shared object in python (I doubt that's an option)

Maybe python needs to be a hard dep. for OBS as a result (and again: no idea whether that's an option)

Offline

#5 2020-10-07 16:01:48

progandy
Member
Registered: 2012-05-17
Posts: 5,318

Re: OBS-Studio Scripts not working with Python 3.8

Shouldn't _PyFloat_Pack4 be exported by libpython3.8.so.1.0 or am I totally misinterpreting the readelf output?

Edit: Maybe obs should use the RTLD_GLOBAL flag for dlopen...
That is covered by another bugreport: https://github.com/obsproject/obs-studio/issues/2222

I wonder if older python versions did import the python library in compiled cpython objects so that bug did not occur?

Last edited by progandy (2020-10-07 16:47:21)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#6 2020-10-07 16:52:57

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: OBS-Studio Scripts not working with Python 3.8

progandy wrote:

Shouldn't _PyFloat_Pack4 be exported by libpython3.8.so.1.0 or am I totally misinterpreting the readelf output?

It absolutely is and must be, since the error comes from here!

ImportError: /usr/lib/python3.8/lib-dynload/_struct.cpython-38-x86_64-linux-gnu.so: undefined symbol: _PyFloat_Pack4

The stdlib module is the thing broken here. The stdlib module manifestly depends on a public shared library symbol for _PyFloat_Pack4.

obs might be exporting a totally broken embedded python interpreter that doesn't actually expose libpython3.8.so.1.0's symbols as it should.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2020-10-07 16:56:34

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: OBS-Studio Scripts not working with Python 3.8

progandy wrote:

Edit: Maybe obs should use the RTLD_GLOBAL flag for dlopen...
That is covered by another bugreport: https://github.com/obsproject/obs-studio/issues/2222

I wonder if older python versions did import the python library in compiled cpython objects so that bug did not occur?

Aha!

I don't get why they dlopen this (EDIT: to make it an optdepend):

$ pkg-list-linked-libraries obs-studio libpython
==> checking linked libraries for obs-studio-26.0.2-1-x86_64.pkg.tar.zst ...
usr/lib/libobs-scripting.so
  NEEDED               libpython3.8.so.1.0
usr/lib/obs-scripting/_obspython.so
  NEEDED               libpython3.8.so.1.0

But nowhere is libpython getting loaded normally.

And in python 3.8, this got changed: https://bugs.python.org/issue21536 so individual compiled modules no longer directly link to libpython.

Last edited by eschwartz (2020-10-07 17:01:16)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2020-10-07 17:04:44

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: OBS-Studio Scripts not working with Python 3.8

Posting that into in the linked upstream ticket would probably be helpful.

Offline

Board footer

Powered by FluxBB