From 9ca80db3fad692b12f6a41dd3cc7b9d297ed4a20 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 19 May 2023 15:45:38 -0400 Subject: [PATCH 1/7] 'pip install virtualenv==20.21.1' for KA Lite on Ubuntu 23.10 --- roles/kalite/tasks/install.yml | 4 ++-- scripts/install_python2.sh | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 674b18f03..09f9858dc 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -38,7 +38,7 @@ name: setuptools==44 virtualenv: "{{ kalite_venv }}" # /usr/local/kalite/venv virtualenv_site_packages: no - virtualenv_command: /usr/bin/virtualenv + virtualenv_command: virtualenv # Traditionally /usr/bin/virtual/env -- but install_python2.sh (for Ubuntu 23.10+) sets up /usr/local/bin/virtualenv virtualenv_python: python2.7 extra_args: "--no-use-pep517 --no-cache-dir --no-python-version-warning" #when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19) @@ -50,7 +50,7 @@ version: "{{ kalite_version }}" virtualenv: "{{ kalite_venv }}" virtualenv_site_packages: no - virtualenv_command: /usr/bin/virtualenv + virtualenv_command: virtualenv virtualenv_python: python2.7 extra_args: "--no-cache-dir" diff --git a/scripts/install_python2.sh b/scripts/install_python2.sh index d61b125d7..f4cf75a19 100755 --- a/scripts/install_python2.sh +++ b/scripts/install_python2.sh @@ -16,7 +16,12 @@ export DEBIAN_FRONTEND=noninteractive ARCH=$(dpkg --print-architecture) -apt -y install virtualenv +# Older version http://launchpadlibrarian.net/651276954/virtualenv_20.19.0+ds-1_all.deb +# unfortunately drags in newer 20.23+ version of python3-virtualenv, preventing Python 2. +# So let's try pip: (which installs to /usr/local/bin) +apt -y install python3-pip +pip install virtualenv==20.21.1 --break-system-packages +#apt -y install virtualenv # https://github.com/iiab/iiab/pull/3535#issuecomment-1503626474 #apt -y install media-types libffi8 libssl3 From e1df2a50613ece4a31d4babf76a1ff29abc64b2f Mon Sep 17 00:00:00 2001 From: root Date: Fri, 19 May 2023 16:38:32 -0400 Subject: [PATCH 2/7] kalite/tasks/install.yml: Force Python 2 if Debian > 11 or Ubuntu > 22.04 --- roles/kalite/tasks/install.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 09f9858dc..f17a3353c 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -17,7 +17,8 @@ - python-setuptools # Provides setuptools-44 on recent OS's (last version compatible with python2) - virtualenv # Drags in 'python3-virtualenv' which in turn drags in 'python3-pip' -- for Ansible module 'pip' when used with 'virtualenv_command: /usr/bin/virtualenv' and 'virtualenv_python: python2.7' -- compare package 'python3-venv' used by roles {calibre-web, jupyterhub, lokole} state: present - when: not (is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310) + when: is_debian_11 or is_ubuntu_2204 # Covers is_linuxmint_12, and is more future-proof than... + #when: not (is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310) # 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already. #- name: Install Ubuntu keyrings on Debian @@ -31,7 +32,8 @@ # use key retrieval from mongodb - name: Use scripts/install_python2.sh to install python2 and virtualenv command: "{{ iiab_dir }}/scripts/install_python2.sh" - when: is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310 + when: not (is_debian_11 or is_ubuntu_2204) # Also avoids is_linuxmint_12, and is more future-proof than... + #when: is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310 - name: Use pip to pin setuptools to 44 in {{ kalite_venv }} # WAS: if Raspbian/Debian > 10 or Ubuntu > 19 pip: From b61053cc3a842f860e93ecec1a4ed360b76500e1 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 19 May 2023 17:38:34 -0400 Subject: [PATCH 3/7] kalite/tasks/install.yml: Fix typos "is_linuxmint_21" --- roles/kalite/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index f17a3353c..2300de138 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -17,7 +17,7 @@ - python-setuptools # Provides setuptools-44 on recent OS's (last version compatible with python2) - virtualenv # Drags in 'python3-virtualenv' which in turn drags in 'python3-pip' -- for Ansible module 'pip' when used with 'virtualenv_command: /usr/bin/virtualenv' and 'virtualenv_python: python2.7' -- compare package 'python3-venv' used by roles {calibre-web, jupyterhub, lokole} state: present - when: is_debian_11 or is_ubuntu_2204 # Covers is_linuxmint_12, and is more future-proof than... + when: is_debian_11 or is_ubuntu_2204 # Covers is_linuxmint_21, and is more future-proof than... #when: not (is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310) # 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already. @@ -32,7 +32,7 @@ # use key retrieval from mongodb - name: Use scripts/install_python2.sh to install python2 and virtualenv command: "{{ iiab_dir }}/scripts/install_python2.sh" - when: not (is_debian_11 or is_ubuntu_2204) # Also avoids is_linuxmint_12, and is more future-proof than... + when: not (is_debian_11 or is_ubuntu_2204) # Also avoids is_linuxmint_21, and is more future-proof than... #when: is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310 - name: Use pip to pin setuptools to 44 in {{ kalite_venv }} # WAS: if Raspbian/Debian > 10 or Ubuntu > 19 From 6dec23b6c3238d851b7c29cecacaaf774917c15e Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 19 May 2023 17:48:16 -0400 Subject: [PATCH 4/7] scripts/install_python2.sh: Explain pip install of older virtualenv --- scripts/install_python2.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/install_python2.sh b/scripts/install_python2.sh index f4cf75a19..b12eccf58 100755 --- a/scripts/install_python2.sh +++ b/scripts/install_python2.sh @@ -16,9 +16,12 @@ export DEBIAN_FRONTEND=noninteractive ARCH=$(dpkg --print-architecture) -# Older version http://launchpadlibrarian.net/651276954/virtualenv_20.19.0+ds-1_all.deb -# unfortunately drags in newer 20.23+ version of python3-virtualenv, preventing Python 2. -# So let's try pip: (which installs to /usr/local/bin) +# 2023-05-19: #3573 -> PR #3582: Ubuntu 23.10's virtualenv 20.23 no longer +# supports Python 2. Older version from Ubuntu 23.04 seemed plausible... +# http://launchpadlibrarian.net/651276954/virtualenv_20.19.0+ds-1_all.deb +# ...but drags in newer 20.23+ version of python3-virtualenv, leaving us +# with /usr/bin/virtualenv 20.23 once again, i.e. preventing Python 2. +# Whereas pip (which installs /usr/local/bin/virtualvenv) at least works: apt -y install python3-pip pip install virtualenv==20.21.1 --break-system-packages #apt -y install virtualenv From e8a3129f13855866f4bc417e19d3fa0704283d41 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 20 May 2023 08:53:45 -0400 Subject: [PATCH 5/7] Further clarify kalite/tasks/install.yml --- roles/kalite/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 2300de138..a819a2cee 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -17,7 +17,7 @@ - python-setuptools # Provides setuptools-44 on recent OS's (last version compatible with python2) - virtualenv # Drags in 'python3-virtualenv' which in turn drags in 'python3-pip' -- for Ansible module 'pip' when used with 'virtualenv_command: /usr/bin/virtualenv' and 'virtualenv_python: python2.7' -- compare package 'python3-venv' used by roles {calibre-web, jupyterhub, lokole} state: present - when: is_debian_11 or is_ubuntu_2204 # Covers is_linuxmint_21, and is more future-proof than... + when: is_debian_11 or is_ubuntu_2204 # Covers is_raspbian_11 and is_linuxmint_21, and is more future-proof than... #when: not (is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310) # 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already. @@ -32,7 +32,7 @@ # use key retrieval from mongodb - name: Use scripts/install_python2.sh to install python2 and virtualenv command: "{{ iiab_dir }}/scripts/install_python2.sh" - when: not (is_debian_11 or is_ubuntu_2204) # Also avoids is_linuxmint_21, and is more future-proof than... + when: not (is_debian_11 or is_ubuntu_2204) # Also avoids is_raspbian_11 and is_linuxmint_21, and is more future-proof than... #when: is_debian_12 or is_ubuntu_2304 or is_ubuntu_2310 - name: Use pip to pin setuptools to 44 in {{ kalite_venv }} # WAS: if Raspbian/Debian > 10 or Ubuntu > 19 From 7209bcd97d98bf1177def425ecccd95a27296b62 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 20 May 2023 17:33:37 -0400 Subject: [PATCH 6/7] install_python2.sh: Summarize messy virtualenv options --- scripts/install_python2.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/install_python2.sh b/scripts/install_python2.sh index b12eccf58..c4ad4b897 100755 --- a/scripts/install_python2.sh +++ b/scripts/install_python2.sh @@ -15,12 +15,11 @@ export DEBIAN_FRONTEND=noninteractive ARCH=$(dpkg --print-architecture) - # 2023-05-19: #3573 -> PR #3582: Ubuntu 23.10's virtualenv 20.23 no longer -# supports Python 2. Older version from Ubuntu 23.04 seemed plausible... +# supports Python 2. Older versions from Ubuntu 22.04 (#3583) & 23.04 like... # http://launchpadlibrarian.net/651276954/virtualenv_20.19.0+ds-1_all.deb -# ...but drags in newer 20.23+ version of python3-virtualenv, leaving us -# with /usr/bin/virtualenv 20.23 once again, i.e. preventing Python 2. +# ...unfortunately drag in newer 20.23+ version of python3-virtualenv, leaving +# us with /usr/bin/virtualenv 20.23 once again, i.e. preventing Python 2. # Whereas pip (which installs /usr/local/bin/virtualvenv) at least works: apt -y install python3-pip pip install virtualenv==20.21.1 --break-system-packages From a55c033a1668c3f7f77b00902ad98f0fb91bfd0a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 20 May 2023 17:35:03 -0400 Subject: [PATCH 7/7] Update install_python2.sh --- scripts/install_python2.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install_python2.sh b/scripts/install_python2.sh index c4ad4b897..5e0089f3b 100755 --- a/scripts/install_python2.sh +++ b/scripts/install_python2.sh @@ -15,6 +15,7 @@ export DEBIAN_FRONTEND=noninteractive ARCH=$(dpkg --print-architecture) + # 2023-05-19: #3573 -> PR #3582: Ubuntu 23.10's virtualenv 20.23 no longer # supports Python 2. Older versions from Ubuntu 22.04 (#3583) & 23.04 like... # http://launchpadlibrarian.net/651276954/virtualenv_20.19.0+ds-1_all.deb