Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

python 3.x - aiobotocore - ImportError: cannot import name 'InvalidIMDSEndpointError'

The code below raise an import exception

import s3fs
fs = s3fs.S3FileSystem(anon=False)

Exception

Traceback (most recent call last):
  File "issue.py", line 1, in <module>
    import s3fs
  File "/home/ubuntu/.local/lib/python3.6/site-packages/s3fs/__init__.py", line 1, in <module>
    from .core import S3FileSystem, S3File
  File "/home/ubuntu/.local/lib/python3.6/site-packages/s3fs/core.py", line 14, in <module>
    import aiobotocore
  File "/home/ubuntu/.local/lib/python3.6/site-packages/aiobotocore/__init__.py", line 1, in <module>
    from .session import get_session, AioSession
  File "/home/ubuntu/.local/lib/python3.6/site-packages/aiobotocore/session.py", line 6, in <module>
    from .client import AioClientCreator, AioBaseClient
  File "/home/ubuntu/.local/lib/python3.6/site-packages/aiobotocore/client.py", line 12, in <module>
    from .utils import AioS3RegionRedirector
  File "/home/ubuntu/.local/lib/python3.6/site-packages/aiobotocore/utils.py", line 10, in <module>
    from botocore.exceptions import (
ImportError: cannot import name 'InvalidIMDSEndpointError'

More details:
OS: Ubuntu 18.04
Python version 3.6

pip3 show s3fs

Name: s3fs
Version: 0.5.1
Summary: Convenient Filesystem interface over S3
Home-page: http://github.com/dask/s3fs/
Location: /home/ubuntu/.local/lib/python3.6/site-packages
Requires: fsspec, aiobotocore

 pip3 show botocore

Name: botocore
Version: 1.19.24
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Location: /home/ubuntu/.local/lib/python3.6/site-packages Requires: jmespath, urllib3, python-dateutil

  pip3 show aiobotocore

Name: aiobotocore
Version: 1.2.0
Summary: Async client for aws services using botocore and aiohttp
Home-page: https://github.com/aio-libs/aiobotocore
Location: /home/ubuntu/.local/lib/python3.6/site-packages
Requires: botocore, wrapt, aioitertools, aiohttp

 pip3 show boto3

Name: boto3
Version: 1.16.52
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Location: /home/ubuntu/.local/lib/python3.6/site-packages
Requires: botocore, s3transfer, jmespath


any ideas what is wrong ?

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Upgrading botocore solved the issue

 pip3 install botocore==1.19.52

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...