Segmentation Fault Python 3.13 venv

Created a fresh Python 3.13 (3.13.0a2) venv, used pip to install ansible, and then tried to use ansible-galaxy:

(venv_313) [me@here tmp]$ ansible-galaxy collection list
Segmentation fault (core dumped)

Tried the same with Python 3.12 and it worked. Both Python versions were fresh installs from native Fedora 37 rpms.

I tried with latest stable Python

#>python --version
Python 3.13.7

and

#>ansible-galaxy collection list

# ... collections/ansible_collections
Collection           Version
-------------------- -------
ansible.netcommon    8.0.1  
ansible.utils        6.0.0  
bcoca.collection     *      
bcoca.fw             *      
bcoca.getent2        1.0.0  
bcoca.harden         *      
bcoca.misc           0.0.1  
bcoca.sysmaint       *      
bcoca.libvirt            0.1
community.crypto     3.0.3  
containers.podman    1.17.0 

What’s the output from PYTHONFAULTHANDLER=1 ansible-galaxy collection list?

Is it specific to Fedora 37 (which is EOL)?

shertel:

(venv_313) [leam@shaphan tmp]$ PYTHONFAULTHANDLER=1 ansible-galaxy collection list
Fatal Python error: Segmentation fault

Current thread 0x00007f97b0010740 (most recent call first):
  File "/home/leam/tmp/venv_313/lib64/python3.13/site-packages/yaml/cyaml.py", line 26 in __init__
  File "/home/leam/tmp/venv_313/lib64/python3.13/site-packages/yaml/__init__.py", line 79 in load
  File "/home/leam/tmp/venv_313/lib64/python3.13/site-packages/ansible/config/manager.py", line 387 in _read_config_yaml_file
  File "/home/leam/tmp/venv_313/lib64/python3.13/site-packages/ansible/config/manager.py", line 319 in __init__
  File "/home/leam/tmp/venv_313/lib64/python3.13/site-packages/ansible/constants.py", line 20 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1010 in exec_module
  File "<frozen importlib._bootstrap>", line 929 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1325 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1354 in _find_and_load
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1409 in _handle_fromlist
  File "/home/leam/tmp/venv_313/lib64/python3.13/site-packages/ansible/cli/__init__.py", line 86 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1010 in exec_module
  File "<frozen importlib._bootstrap>", line 929 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1325 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1354 in _find_and_load
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1304 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1354 in _find_and_load
  File "/home/leam/tmp/venv_313/bin/ansible-galaxy", line 5 in <module>

Extension modules: markupsafe._speedups, yaml._yaml (total: 2)
Segmentation fault (core dumped)

and:

cat venv/bin/ansible-galaxy 

#!/home/leam/tmp/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from ansible.cli.galaxy import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

PyYAML added support for Python 3.13 only recently and Python 3.13.0a2 is old and preview. I would try upgrading to a stable version.

I can back it down to 3.12, but I’m saddened that the ecosystem is so fragile.

Alpha versions are fragile by nature

2 Likes