I had the same error on one client machine and not another one even though both machines had LANG=en_GB.UTF-8 in /etc/default/locale and ran identical python version 3.8.10.
After some debugging using strace I found that the solution was to install/configure the en_US.UTF-8 locale using
dpkg-reconfigure locales
and making sure the en_US.UTF-8 was selected.
Also, I don't think a fix should alter the locale on a client machine (i.e. using update-locale) given that the whole point in locales is to support different regions and you would prevent the client from achieving this.
I had the same error on one client machine and not another one even though both machines had LANG=en_GB.UTF-8 in /etc/default/locale and ran identical python version 3.8.10.
After some debugging using strace I found that the solution was to install/configure the en_US.UTF-8 locale using
dpkg-reconfigure locales
and making sure the en_US.UTF-8 was selected.
Also, I don't think a fix should alter the locale on a client machine (i.e. using update-locale) given that the whole point in locales is to support different regions and you would prevent the client from achieving this.