galaxyproject / galaxyproject/training-material

Installation failure of Ansible playbook due to deprecated lib2to3 module

Open
#6,001 0 comments 0 reactions 0 assignees View on GitHub
admin
Dominant language
HTML
Stars
367
Forks
1.1k
Avg merge
16h 27m
Merged PRs (30d)
49

Description

### ModuleNotFound error during playbook run
After updating to the latest Galaxy release (v24.2, `galaxy_commit_id: release_24.2`) in the `./galaxy/group_vars/galaxyservers.yml` config file, the [Galaxy Admin tutorial playbook](https://training.galaxyproject.org/training-material/topics/admin/tutorials/ansible-galaxy/tutorial.html) (Revision: 102, Last modified: Apr 8, 2025) deployment fails on Ubuntu 24.04 LTS with the following error:
```
TASK [galaxyproject.galaxy : Get current Galaxy DB version] *****************************************************
fatal: [localhost]: FAILED! => changed=false
cmd:
- /srv/galaxy/venv/bin/python
- /srv/galaxy/server/scripts/manage_db.py
- -c
- /srv/galaxy/config/galaxy.yml
- db_version
delta: '0:00:00.765326'
end: '2025-04-25 18:07:44.262573'
failed_when_result: true
msg: non-zero return code
rc: 1
start: '2025-04-25 18:07:43.497247'
stderr: |-
Traceback (most recent call last):
File "/srv/galaxy/server/scripts/manage_db.py", line 12, in
from galaxy.model.migrations.scripts import LegacyManageDb
File "/srv/galaxy/server/lib/galaxy/model/__init__.py", line 146, in
from galaxy.files.templates import (
File "/srv/galaxy/server/lib/galaxy/files/__init__.py", line 16, in
from galaxy.files.sources import (
File "/srv/galaxy/server/lib/galaxy/files/sources/__init__.py", line 37, in
from galaxy.util.template import fill_template
File "/srv/galaxy/server/lib/galaxy/util/template.py", line 28, in
from lib2to3.refactor import RefactoringTool
ModuleNotFoundError: No module named 'lib2to3'
stderr_lines:
stdout: ''
stdout_lines:
ModuleNotFoundError: No module named 'lib2to3'
```
---
### Workaround
After manually installing
```
sudo apt install python3-lib2to3
```

the playbook is running the deployment without further issues.

---
### Root Cause

Ubuntu 24.04 LTS uses Python 3.12. The Python `lib2to3` package is deprecated since version 3.11 and will be removed completely in version 3.13 (https://docs.python.org/3.11/library/2to3.html).

---
### Proposed Fixes

I added a Python and platform version check to the `pre-tasks` section of the `galaxy.yml` playbook template to install the `lib2to3` package if necessary. As part of the fix I also updated the role versions in `requirements.yml`, and adjusted the Galaxy release and Miniconda versions in `group_vars/galaxyservers.yml`. I will create a pull request.

Contributor guide

Open the contributing guide

Research direction

Start with the Galaxy Admin tutorial playbook and reproduce the failure on Ubuntu 24.04. Inspect galaxy.yml, requirements.yml, and galaxy/group_vars/galaxyservers.yml, then trace the import from server/scripts/manage_db.py through galaxy/util/template.py. Done means the playbook completes without manually installing python3-lib2to3 and the documented Galaxy and role versions remain consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, python, ubuntu
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.