If you are confused with the problem “AttributeError: module ‘aiobotocore’ has no attribute ‘AioSession'”, don’t worry. We will give you some solutions to fix it in this article. Read on it.
What are s3fs and aiobotocore ?
S3fs is a FUSE (File System in User Space) that will mount Amazon S3 as a local file system on your computer, meaning you can manipulate Amazon S3 cloud computing like you manipulate data on your computer. Your. S3FS is capable of manipulating Amazon S3 buckets in a variety of ways. If you want to access the Amazon S3 bucket without having to mount it on your computer (or server), you can use command line tools like s3cmd, clone, AWS… to manage the S3 bucket.
Features of S3FS:
- Compatible with S3 protocol-based object cloud storage services such as Swift OpenStack, Google Cloud Storage, Amazon S3
- Support for large files through the multi-part upload
- Rename via server-side replication
- Data integrity with MD5
- Caching metadata on memory
- Caching data on local disk
- Authentication via signature versions 2 and 4
Aiobotocore is the python library that is a primarily full featured asynchronous version of botocore. First and foremost, an async client for Amazon services that use both async io and botocore. This library is an asynchronous version of botocore with all of its features.
Terminal:
pip install aiobotocore
How does the error “AttributeError: module ‘aiobotocore’ has no attribute ‘AioSession’” happen?
In the example below, we used the old version aiobotocore library so this error appeared.
Terminal:
pip install s3fs
pip install colab-env -qU
Code:
import os import s3fs import colab_env WORKING_DIR = f"." MY_AWS_s3_KEY = os.environ[f'MY_AWS_S3_KEY'] MY_AWS_s3_SECRET = os.environ[f'MY_AWS_s3_SECRET'] fs = s3fs.S3Filesystem(key=MY_AWS_s3_KEY, secret=MY_AWS_s3_SECRET) fs.ls('my-bucket')
Output:
AttributeError: module 'aiobotocore' has no attribute 'AioSession'
When you run the above program on your IDE, the code will show an error as the output. Here are some ways to fix this. Stay tuned for more details.
Solutions to fix this error
Upgrade the latest version of aiobotocore
You can use one command to upgrade the aiobotocore version. Your file to be able to fix this error, and it will not appear anymore.
Terminal:
The above error is resolved when you run this command line and upgrade the library version.
Upgrade s3fs version to 2021.08.0 or higher
You can check your s3fs version using the command below:
Terminal:
s3fs.__version__
If the version is lower than 2021.08.0, you should upgrade your s3fs version to the higher version. Maybe this will fix your error.
Summary
To summarize, this article shows you how to fix the error “AttributeError: module ‘aiobotocore’ has no attribute ‘AioSession'”. You can try to upgrade the latest version of aiobotocore or upgrade the s3fs version to 2021.08.0 or higher. Good luck!
Maybe you are interested:
- AttributeError: module ‘keras.engine’ has no attribute ‘Layer’ in Python
- AttributeError: partially initialized module has no attribute
- AttributeError module ‘datetime’ has no attribute ‘now’

Hi, my name’s Nathaniel Kirk. I’m interested in learning and sharing knowledge about programming languages. My strengths are C, C++, Python, HTML, CSS, Javascript, and Reactjs. If you have difficulty with them, don’t worry. I’m here to support you.
Name of the university: PTIT
Major: IT
Programming Languages: C, C++, Python, HTML, CSS, Javascript, Reactjs