Skip to content

Commit fc4bfb2

Browse files
author
Derek
committed
fix(gnome): use --ignore-installed for pip upgrade on Ubuntu
On Ubuntu 24.04+, distro-packaged pip lacks a RECORD file, causing ansible.builtin.pip to fail with "Cannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian." Switch to ansible.builtin.command with --ignore-installed flag to install pip/pipx alongside the distro versions rather than trying to uninstall them first. Fixes template build failures for desktop templates.
1 parent e3c76ae commit fc4bfb2

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

ansible/roles/dfe_developer/tasks/gnome_common.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,36 @@
5050

5151
# Distro-packaged pipx can be outdated (Ubuntu 24.04 has 1.4.3).
5252
# community.general.pipx requires >= 1.7.0 for application parameter.
53-
# Upgrade pip and pipx system-wide - overwrites older distro versions in-place.
53+
# Upgrade pip and pipx system-wide - installs alongside distro versions.
5454
# --break-system-packages required on Ubuntu 24.04+ (PEP 668 protection).
55+
# --ignore-installed avoids "Cannot uninstall pip, RECORD file not found" error.
5556
- name: Upgrade pip to latest (system-wide)
57+
ansible.builtin.command:
58+
cmd: python3 -m pip install --upgrade --break-system-packages --ignore-installed pip
59+
become: true
60+
when: ansible_facts['distribution'] == 'Ubuntu'
61+
changed_when: true
62+
63+
- name: Upgrade pip to latest (Fedora)
5664
ansible.builtin.pip:
5765
name: pip
5866
state: latest
59-
extra_args: "{{ '--break-system-packages' if ansible_facts['distribution'] == 'Ubuntu' else omit }}"
6067
become: true
61-
when: ansible_facts['distribution'] in ['Ubuntu', 'Fedora']
68+
when: ansible_facts['distribution'] == 'Fedora'
6269

6370
- name: Upgrade pipx to latest (system-wide)
71+
ansible.builtin.command:
72+
cmd: python3 -m pip install --upgrade --break-system-packages --ignore-installed pipx
73+
become: true
74+
when: ansible_facts['distribution'] == 'Ubuntu'
75+
changed_when: true
76+
77+
- name: Upgrade pipx to latest (Fedora)
6478
ansible.builtin.pip:
6579
name: pipx
6680
state: latest
67-
extra_args: "{{ '--break-system-packages' if ansible_facts['distribution'] == 'Ubuntu' else omit }}"
6881
become: true
69-
when: ansible_facts['distribution'] in ['Ubuntu', 'Fedora']
82+
when: ansible_facts['distribution'] == 'Fedora'
7083

7184
- name: Install gnome-extensions-cli via pipx
7285
community.general.pipx:

0 commit comments

Comments
 (0)