Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

attributeerror: 'AioClientCreator' object has no attribute '_register_lazy_block_unknown_fips_pseudo_regions'

Recently, I have started to occupy the AWS platform, but when trying to occupy Sagemaker, the following error and I don't know if it is because of Sagemaker or it has something to do with ´´Parquet Dataset´´

session = sagemaker.Session()
region = boto3.Session().region_name
role = get_execution_role()

import pyarrow.parquet as pq
import s3fs
s3 = s3fs.S3FileSystem()

bucket = 's3://xx'

df = pq.ParquetDataset(bucket, filesystem=s3).read_pandas().to_pandas()

Up to this point everything loads fine, but I have the following error

 attributeerror: 'AioClientCreator' object has no attribute '_register_lazy_block_unknown_fips_pseudo_regions'

AttributeError

I do not know, what could be the error

like image 722
user0454457 Avatar asked Nov 16 '21 19:11

user0454457


People also ask

How to fix attributeerror 'list' object has no attribute?

The Python "AttributeError: 'list' object has no attribute" occurs when we access an attribute that doesn't exist on a list. To solve the error, access the list element at a specific index or correct the assignment. Here is an example of how the error occurs. Copied!

Why was _Register_lazy_block_unknown_FIPS_pseudo_regions removed from aibotocore?

This function in question ( _register_lazy_block_unknown_fips_pseudo_regions) was intentionally removed as it was used to prevent unknown/new region endpoint variants from actually being used to make API calls while allowing the client to be constructed, and seems to have been added to aibotocore inadvertently.

Why am I not getting attributeerror in Python?

Than their is no problem and not getting”Attribute error”. Note: Attribute errors in Python are generally raised when an invalid attribute reference is made. There is a few chances of getting AttributeError. Example 2: Sometimes any variation in spelling will cause an Attribute error as Python is a case-sensitive language.

Why is aiobotocore not working with Aicall?

call is using s3fs library (from your trace that you posted), whose dependencies have aiobotocore version as aiobotocore~=1.4.1. This itself is not causing the issue (but we do need to check out aiobotocore anyway) as we can see that the 1.4.1 release (and above) do have that attribute in the source code here.


2 Answers

Same here. According to this issue, it's having to do with botocore removing this function.

This function in question (_register_lazy_block_unknown_fips_pseudo_regions) was intentionally removed as it was used to prevent unknown/new region endpoint variants from actually being used to make API calls while allowing the client to be constructed, and seems to have been added to aibotocore inadvertently.

I was able to resolve the issue by using botocore==1.22.5.


Edit:

I've since tried again to get everything working together. Here is my Pipfile which seems to work without throwing errors like those reported by @Drwhit. I believe that error is coming from this issue.

s3fs = {version = "~=2021.4", extras = ["boto3"]}
aiohttp = "==3.7.2"
botocore = "==1.22.8"
aiobotocore = "==2.0.1"
like image 184
Wesley Cheek Avatar answered Nov 15 '22 11:11

Wesley Cheek


For making this work, in an environment with some libraries already installed, I needed to issue some uninstall commands, before installing the old boto3 version:

pip uninstall boto3
pip uninstall botocore
pip uninstall aiobotocore

Then issued this one:

pip install boto3==1.17.106

...and finally worked.

Should any conflict issue arises when installing that specific boto3 version, just uninstall the package that is in conflict (happened to me with a version of sagemaker). If you need it, reinstall after installing boto3 old version. No guarantee that will work at the end; trial and error will help.

When done, issue pip list, so you can get the complete list of versions that work, and put it with the appropriate syntax changes into a requirements.txt file, so you can build your environment later.

like image 30
Jose Rondon Avatar answered Nov 15 '22 10:11

Jose Rondon