ImportError: cannot import name ReadTimeoutError when trying to create s3 client
See original GitHub issuetrying to create a boto3 s3 client on EMR Master node.
- boto3 version: 1.9.90
- requests version 1.2.3
- python 2.7.14
just running this in the python interpreter:
s3 = boto3.client('s3')
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/boto3/__init__.py", line 91, in client
return _get_default_session().client(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/boto3/session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "/usr/lib/python2.7/dist-packages/botocore/session.py", line 861, in create_client
client_config=config, api_version=api_version)
File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 70, in create_client
cls = self._create_client_class(service_name, service_model)
File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 95, in _create_client_class
base_classes=bases)
File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 227, in emit
return self._emit(event_name, kwargs)
File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 210, in _emit
response = handler(**kwargs)
File "/usr/local/lib/python2.7/site-packages/boto3/utils.py", line 61, in _handler
module = import_module(module)
File "/usr/local/lib/python2.7/site-packages/boto3/utils.py", line 52, in import_module
__import__(name)
File "/usr/local/lib/python2.7/site-packages/boto3/s3/inject.py", line 15, in <module>
from boto3.s3.transfer import create_transfer_manager
File "/usr/local/lib/python2.7/site-packages/boto3/s3/transfer.py", line 129, in <module>
from s3transfer.manager import TransferConfig as S3TransferConfig
File "/usr/local/lib/python2.7/site-packages/s3transfer/manager.py", line 21, in <module>
from s3transfer.utils import get_callbacks
File "/usr/local/lib/python2.7/site-packages/s3transfer/utils.py", line 27, in <module>
from botocore.exceptions import ReadTimeoutError
ImportError: cannot import name ReadTimeoutError
This appears to be a package structure problem to me
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (5 by maintainers)
Top Results From Across the Web
Python import boto3 error: cannot import name ClientError
The program cannot correctly import boto3. When it tries to import boto3 for the first time, Python gives error ImportError: cannot import name...
Read more >Error handling — Boto3 Docs 1.18.48 documentation - AWS
import botocore import boto3 client = boto3.client('aws_service_name') try: client.some_api_call(SomeParam='some_param') except botocore.exceptions.
Read more >Unable to run AWS CLI: "ImportError: cannot import name ...
New to linux, I just installed AWS CLI alongside Python3 and boto3 but I get this error when I tried running AWS CLI....
Read more >Creating and using Amazon S3 buckets - AWS Documentation
Create a libs directory, and create a Node.js module with the file name s3Client.js . Copy and paste the code below into it,...
Read more >3 ways to test S3 in Python - Sanjay Siddhanti
from dataclasses import dataclass import json import boto3 S3_BUCKET = "recipes" def get_s3(): return boto3.client("s3") @dataclass class ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
honestly, I don’t know what version of botocore I had… I ended up specifying the following versions and everything worked nicely for me after that: botocore==1.12.91 urllib3==1.24.1 boto3==1.9.91
Update: It turns out the problem was a mismatch between the provided boto libraries in AWS Lambda and the libraries I packaged into my Lambda code.
Fixed once I improved my packaging approach. Thanks!