I encountered this issue when I was working on integrating the android build system to poetry in the Mnemosyne project. This required bumping up the current python version of the project to 3.10.
I was working through the steps of building and debugging the Android client, which requires the python-for-android package (P4A).This in turn requires the sh package. A conventional poetry add
failed. A debugged(?) pip install also failed.
The cause of this is that the latest version of sh is 2.0.6. However, when the sh package updated to version2.0, the python-for-android project decided to restrict the sh version that they are using to be less than version2.0 because of behavior changes in the sh package. This restriction was merged into P4A on February 11, 2023. This was also mentioned and referenced by other projects that depended on sh subsequently.
The lower bound of the restriction is 1.10, while the latest version1 of the sh package is 1.14. 1.10 has an string error that causes an installation error for the sh package. 1.14 breaks P4A because sh used a Mapping object, which was moved from the collections module to collections.abc in Python3.10.
If you encounter this edge case, the temporary remedy is to use sh version 1.13 in your requirements.txt or pyproject.toml.