boto3: ImportError: cannot import name ReadTimeoutError when trying to create s3 client
trying 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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (5 by maintainers)
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!