Ich führe eine Python-Anwendung mit Python 3.11.14 in einem Docker-Container aus und habe Probleme mit boto3.
Umgebung
- Python: 3.11.14
- boto3: 1.34.0
- botocore: 1.34.0
- urllib3: 1.26.18
- OS: redhat/ubi10-minimal
Beim Importieren oder Initialisieren einer S3-Ressource:
Code: Select all
import boto3
voice_s3 = boto3.resource("s3")
Code: Select all
RecursionError: maximum recursion depth exceeded
File ".../botocore/httpsession.py", line 349, in _get_ssl_context
return create_urllib3_context()
Versuchter Fix: Downgrade von boto3
Ich habe versucht, die aktuelle Version zu entfernen und eine ältere zu installieren:
Code: Select all
pip uninstall boto3
pip install boto3==1.9.164
Nach dem Downgrade schlägt die Anwendung beim Import sofort fehl:
Code: Select all
ImportError: cannot import name 'Mapping' from 'collections'
Code: Select all
botocore/vendored/requests/packages/urllib3/_collections.py
- Boto3 herunterstufen
- Boto3 erneut aktualisieren auf die neueste Version
- urllib3==1.26.18 beibehalten
- Das Docker-Image von Grund auf neu erstellen
- Neues boto3 → RecursionError
- Altes boto3 → ImportError: Mapping from Sammlungen
- Ist boto3 offiziell mit Python 3.11 kompatibel?
- Welche Versionskombination von boto3, botocore und urllib3 sollte mit Python 3.11 verwendet werden?
- Ist das ein bekanntes Problem mit SSL / urllib3-Rekursion?
- Was ist der richtige Weg, dieses Problem zu beheben, ohne Python herunterzustufen?
Vollständiger Stack-Trace (abgekürzt)
Code: Select all
RecursionError: maximum recursion depth exceeded
File ".../ssl.py", line 624, in options
File ".../botocore/httpsession.py", line 349, in _get_ssl_context
Code: Select all
ImportError: cannot import name 'Mapping' from 'collections'
Mobile version