When trying to use newer versions of pip on a remote headless system, it requires keyring access, or will at least use it if present. When running poetry installed via pipx, it installs keyring and it all breaks. Here's how I fixed it today.
Install development headers (assumes build tools already installed).
sudo apt install -y libkeyutils-dev
Enter the bin dir for the poetry pipx environment and install the keyutils extension for keyring.
cd $(dirname $(readlink -f $(which poetry)))
./pip3 install git+https://github.com/marcus-h/python-keyring-keyutils.git
Now configure keyring to use the new backend
kring_conf_root="$(python -c 'import keyring.util.platform_;print(keyring.util.platform_.config_root())')"
mkdir -p "${kring_conf_root}"
echo -e "[backend]\ndefault-keyring=keyutils.backend.KeyutilsKeyringBackend" > \
"${kring_conf_root}/keyringrc.cfg"