From 1aa8139a90757935c463fbf4cb612d9967e503bb Mon Sep 17 00:00:00 2001 From: j4n Date: Thu, 11 Jun 2026 07:55:58 +0200 Subject: [PATCH] fix(cmdeploy): remove broken venv Failed on system upgrade with Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding --- cmdeploy/src/cmdeploy/deployers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmdeploy/src/cmdeploy/deployers.py b/cmdeploy/src/cmdeploy/deployers.py index 933a4477..bc8e3b40 100644 --- a/cmdeploy/src/cmdeploy/deployers.py +++ b/cmdeploy/src/cmdeploy/deployers.py @@ -98,6 +98,15 @@ def _install_remote_venv_with_chatmaild(deployer) -> None: dest=remote_dist_file, ) + # Remove venv if its Python is broken, e.g., after OS release upgrade + server.shell( + name="remove stale chatmaild venv if python is broken", + commands=[ + f"{remote_venv_dir}/bin/python -c 'import sys' 2>/dev/null" + f" || rm -rf {remote_venv_dir}", + ], + ) + pip.virtualenv( name=f"chatmaild virtualenv {remote_venv_dir}", path=remote_venv_dir,