python-3.x - aiobotocore - 导入错误 : cannot import name 'InvalidIMDSEndpointError'

标签 python-3.x boto3 ubuntu-18.04 python-s3fs

下面的代码引发导入异常

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'
更多详情:
操作系统:Ubuntu 18.04
Python 3.6 版
pip3 show s3fs
名称:s3fs
版本:0.5.1
总结:S3 上方便的文件系统接口(interface)
首页:http://github.com/dask/s3fs/
位置:/home/ubuntu/.local/lib/python3.6/site-packages
需要:fsspec、aiobotocore
 pip3 show botocore
名称:botocore
版本:1.19.24
总结:boto 3 的底层数据驱动核心。
首页:https://github.com/boto/botocore
位置:/home/ubuntu/.local/lib/python3.6/site-packages
需要:jmespath、urllib3、python-dateutil
  pip3 show aiobotocore
名称: aiobotocore
版本:1.2.0
总结:使用 botocore 和 aiohttp 的 aws 服务异步客户端
首页:https://github.com/aio-libs/aiobotocore
位置:/home/ubuntu/.local/lib/python3.6/site-packages
需要:botocore、wrapt、aioitertools、aiohttp
 pip3 show boto3
名称:boto3
版本:1.16.52
摘要:适用于 Python 的 AWS 开发工具包
首页:https://github.com/boto/boto3
位置:/home/ubuntu/.local/lib/python3.6/site-packages
需要:botocore、s3transfer、jmespath

任何想法有什么问题?
谢谢

最佳答案

您还可以将 aiobotocore 降级到旧版本 1.1.2。 S3fs==0.5.1 仅依赖于 aiobotocore >= 1.0.1。使用 johnnydep可视化依赖树 ( pip install johnnydep )

$ johnnydep s3fs==0.5.1

s3fs==0.5.1                              Convenient Filesystem interface over S3
├── aiobotocore>=1.0.1                   Async client for aws services using botocore and aiohttp
│   ├── aiohttp>=3.3.1                   Async http client/server framework (asyncio)
│   │   ├── async-timeout<4.0,>=3.0      Timeout context manager for asyncio programs
│   │   ├── attrs>=17.3.0                Classes Without Boilerplate
│   │   ├── chardet<4.0,>=2.0            Universal encoding detector for Python 2 and 3
│   │   ├── multidict<7.0,>=4.5          multidict implementation
│   │   ├── typing-extensions>=3.6.5     Backported and Experimental Type Hints for Python 3.5+
│   │   └── yarl<2.0,>=1.0               Yet another URL library
│   │       ├── idna>=2.0                Internationalized Domain Names in Applications (IDNA)
│   │       └── multidict>=4.0           multidict implementation
│   ├── aioitertools>=0.5.1              itertools and builtins for AsyncIO and mixed iterables
│   │   └── typing_extensions>=3.7       Backported and Experimental Type Hints for Python 3.5+
│   ├── botocore<1.19.53,>=1.19.52       Low-level, data-driven core of boto 3.
│   │   ├── jmespath<1.0.0,>=0.7.1       JSON Matching Expressions
│   │   ├── python-dateutil<3.0.0,>=2.1  Extensions to the standard Python datetime module
│   │   │   └── six>=1.5                 Python 2 and 3 compatibility utilities
│   │   └── urllib3<1.27,>=1.25.4        HTTP library with thread-safe connection pooling, file post, and more.
│   └── wrapt>=1.10.10                   Module for decorators, wrappers and monkey patching.
└── fsspec>=0.8.0                        File-system specification

关于python-3.x - aiobotocore - 导入错误 : cannot import name 'InvalidIMDSEndpointError' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65688584/

相关文章:

mysql - Ubuntu 18.04 无root权限启动mysql

python - 生成集合中所有大小相等的分区

asp.net-mvc - MVC UI 与 python 后端

python - 无法从网页中获取一些分散的项目

python - 获取 ElastiCache 标签

python - 如何解决 "botocore.exceptions.ClientError: An error occurred (AccessDenied)"错误?

没有明显原因的python boto3连接错误

ssl - MyDomain.com 仅提供正向 SSL 证书的可复制文本 : one for cert and one for key. 如何在我的 nginx Web 服务器上安装它?

python - 使用 subprocess.Popen 通过 SSH 或 SCP 发送密码

python - 多语言 ubuntu 无法下载语言文件