-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import failure on from boto3.s3.transfer import TransferConfig
#3951
Comments
Hi @PSRCode, Thanks for reaching out about this. It looks like you may have an older version of the awscrt installed alongside Boto3. With the release of Boto3 1.33.0, it requires If that's not an option, you can disable boto3 using the awscrt with the |
Hi @nateprewitt, Thanks for the quick response. Ok, we will make sure to use awscrt > 0.19.17. I'll report back when I have some time to look into it. What's weird is that we do not define a version for "awscrt" in our requirement.txt so I would expect that we use latest. Maybe a noob question, how would one should have "known" that we need that version. I would have expected boto3 to "enforce" the version for awscrt. |
The As far as knowing, this feature has been in place for ~2 years and is intended to be a no-hassle opt-in. That does however make it harder to track for dependency management. If you know you're installing boto3 in conjunction with one of the other tools above, you can change your requirement to We're discussing options to try to minimize (or ideally eliminate) these kinds of import issues with version mismatches and the awscrt going forward. |
We've hit this very issue today on Amazon Linux 2023 that comes with We can't easily upgrade |
Thanks for letting us know @lisenet. We found the CRT copy on AL2023 was outdated yesterday and are working on a fix to help mitigate that case. We'll provide an update here once that's available. |
Same @nateprewitt - the updated crt version is not yet available in the AWS repos. I'm willing to bet this broke a lot of things for a lot of organizations. We had to pin the older version of boto3 as well. |
My guess is that since |
That's correct, AL2023 adding the CRT to the default Python setup was not a known integration point before yesterday. A quick note of clarity that boto3 should always be used in a virtualenv to avoid unintentional interactions with the default Python installation, but we're in the process of releasing a change to fix this now. We expect this issue to be resolved in 1.33.3. |
Superb, appreciate the response. |
Alright, 1.33.3 is published. I'll leave this open for a bit to gather any feedback/issues but will plan to close this tomorrow if we don't hear back. Thanks everyone for your patience. |
Evening. I've also been having an issue. I just updated and I'm still receiving the following error: ImportError: cannot import name 'S3ResponseError' from 'awscrt.s3' (/usr/local/lib/python3.12/site-packages/awscrt/s3.py) Installed is the following: pip freeze | grep awscrt -------> awscrt==0.19.18 pip freeze | grep boto3. -------> boto3==1.33.3 It's probably me, however all was good last week. Many thanks for any help you could provide. |
Hi @hsec, yes this was from a change made yesterday. What version of s3transfer do you have installed? If it's not the latest, |
Hi. Thank you for responding. I have 0.8.1. I ran pip install s3transfer>=0.8.2, but no update was available. |
0.8.2 should be available on PyPI. Also to double check from what you wrote above, you're using |
Hi. This error is local. I successfully installed the 0.8.2 version: Uninstalling s3transfer-0.8.1: and the previous error has gone away. I do however now get a S3ResponseError: ImportError: cannot import name 'S3ResponseError' from 'awscrt.s3' (/usr/local/lib/python3.12/site-packages/awscrt/s3.py) Perhaps I'm doing something incorrectly. Do I need to update all of the components to the latest version? |
You'll either need everything with the current requirements or the older ones. You won't be able to mix old and new. If you start a fresh virtualenv and i.e. python -m venv .venv
source .venv/bin/activate
python -m pip install "boto3[crt]"
python -c 'import awscrt;import boto3;import botocore;import s3transfer;print(f"Boto3: {boto3.__version__}, Botocore: {botocore.__version__}, S3Transfer: {s3transfer.__version__}, CRT: {awscrt.__version__}")' If the above still fails, you may try these one at a time: python -c 'import awscrt; print(f"CRT: {awscrt.__version__}")'
python -c 'import boto3; print(f"Boto3: {boto3.__version__}")'
python -c 'import botocore; print(f"Botocore: {botocore.__version__}")'
python -c 'import s3transfer; print(f"Botocore: {botocore.__version__}")' |
Unfortunately, I'm still getting the same error. |
What version of the modules (in their entirety), still work, and wha would be the besrt way to about that? Many thanks in advance. |
Good morning. I uninstalled boto3 (1.33.3) and installed version 1.33.4 and all is good again. Thank you again for your patience and rapid response. |
Great to hear, @hsec. I'm going to put this in auto-resolve since the original issue is no longer reproducible and we haven't heard back on further issues in the last 24 hours. |
|
Describe the bug
Hi,
Since Boto3 v1.33.0 we see a failure to import the following from our code application:
from boto3.s3.transfer import TransferConfig
Resulting in the following redacted Traceback:
The same import is working fine on 1.29.7.
Looking at the change log not much seems to be related apart from this:
* feature:``s3``: Boto3 will now opt into using the awscrt on select EC2 instance types for s3 transfers.
For now we will freeze our version locally to 1.29.7.
Cheers
Expected Behavior
The import should work.
Current Behavior
The import is broken.
Reproduction Steps
from boto3.s3.transfer import TransferConfig
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.33.0/1
Environment details (OS name and version, etc.)
Ubuntu 22.04.2
The text was updated successfully, but these errors were encountered: