Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error after update python from 3.10.13 to 3.10.14 - ModuleNotFoundError: No module named 'xmlrpclib' #1636

Closed
unlike777 opened this issue Mar 23, 2024 · 6 comments

Comments

@unlike777
Copy link

After the release of python 3.10.14
supervisor stopped working

Install in docker "apk add supervisor" based on Alpine

Error in docker container:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/supervisord", line 33, in <module>
    sys.exit(load_entry_point('supervisor==4.2.4', 'console_scripts', 'supervisord')())
  File "/usr/bin/supervisord", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/supervisor/supervisord.py", line 38, in <module>
    from supervisor.medusa import asyncore_25 as asyncore
  File "/usr/lib/python3.10/site-packages/supervisor/medusa/asyncore_25.py", line 58, in <module>
    from supervisor.compat import as_string, as_bytes
  File "/usr/lib/python3.10/site-packages/supervisor/compat.py", line 69, in <module>
    import xmlrpclib
ModuleNotFoundError: No module named 'xmlrpclib'
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/supervisor/compat.py", line 67, in <module>
    import xmlrpc.client as xmlrpclib
  File "/usr/lib/python3.10/xmlrpc/client.py", line 138, in <module>
    from xml.parsers import expat
  File "/usr/lib/python3.10/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: Error relocating /usr/lib/python3.10/lib-dynload/pyexpat.cpython-310-x86_64-linux-gnu.so: XML_SetReparseDeferralEnabled: symbol not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/supervisord", line 33, in <module>
    sys.exit(load_entry_point('supervisor==4.2.4', 'console_scripts', 'supervisord')())
  File "/usr/bin/supervisord", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/supervisor/supervisord.py", line 38, in <module>
    from supervisor.medusa import asyncore_25 as asyncore
  File "/usr/lib/python3.10/site-packages/supervisor/medusa/asyncore_25.py", line 58, in <module>
    from supervisor.compat import as_string, as_bytes
  File "/usr/lib/python3.10/site-packages/supervisor/compat.py", line 69, in <module>
    import xmlrpclib
ModuleNotFoundError: No module named 'xmlrpclib'
@unlike777
Copy link
Author

unlike777 commented Mar 23, 2024

Link to python issue python/cpython#117173

@hartwork
Copy link

Which version of Alpine is this with, what is the SHA256 image digest of the image?

I played with Alpine 3.17 — docker run -it --rm --pull=always alpine:3.17 sh -i — and it seems fine:

# cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.17.7
PRETTY_NAME="Alpine Linux v3.17"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

# apk add supervisor
OK: 74 MiB in 33 packages

# python3 --version
Python 3.10.14

# grep -F XML_SetReparseDeferralEnabled /usr/lib/python3.10/lib-dynload/pyexpat.cpython-310-x86_64-linux-gnu.so 
XML_SetReparseDeferralEnabled

# grep -F XML_SetReparseDeferralEnabled /usr/lib/libexpat.so.1.9.2
XML_SetReparseDeferralEnabled

# python3 -c 'from pyexpat import *' && echo GOOD.
GOOD.

@unlike777
Copy link
Author

@hartwork

Thank you very much for being included!

I use alpine:3, 3.16, 3.16.3, latest

Install the supervisor:
apk add supervisor

[supervisor 1/3] RUN apk add supervisor
2.126 (1/10) Installing mpdecimal (2.5.1-r1)
2.437 (2/10) Installing python3 (3.10.14-r0)
3.440 (3/10) Installing py3-appdirs (1.4.4-r3)
3.483 (4/10) Installing py3-more-itertools (8.13.0-r0)
3.532 (5/10) Installing py3-ordered-set (4.0.2-r3)
3.575 (6/10) Installing py3-parsing (2.4.7-r3)
3.629 (7/10) Installing py3-six (1.16.0-r1)
3.672 (8/10) Installing py3-packaging (21.3-r0)
3.720 (9/10) Installing py3-setuptools (59.4.0-r0)
3.818 (10/10) Installing supervisor (4.2.4-r0)

@hartwork
Copy link

@unlike777 even with Alpine 3.16 things seem to work fine over here:

# docker run -it --rm --pull=always alpine:3.16 sh -c 'apk add -q supervisor ; python3 -c "from pyexpat import *" && echo GOOD.'
3.16: Pulling from library/alpine
Digest: sha256:452e7292acee0ee16c332324d7de05fa2c99f9994ecc9f0779c602916a672ae4
Status: Image is up to date for alpine:3.16
GOOD.

@unlike777
Copy link
Author

unlike777 commented Mar 25, 2024

The solution is to rebuild Alpine image

@mnaberez
Copy link
Member

Closing since the above comments indicate this is not a bug in Supervisor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants