carpentries-incubator / geospatial-python

Introduction to Geospatial Raster and Vector Data with Python
https://carpentries-incubator.github.io/geospatial-python/
Other
159 stars 57 forks source link

AttributeError: module 'boto3' has no attribute 'Session' #132

Closed GKG1312 closed 1 year ago

GKG1312 commented 1 year ago

Hi, I am trying to download some specific bands from the Sentinel-2 L2A product using your code snippets:

import rioxarray

b01_href = assets["B01"].href
b01 = rioxarray.open_rasterio(b01_href)
print(b01)

But I am getting the following errors:

KeyError: [, ('https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/43/Q/EU/2023/3/S2B_43QEU_20230312_0_L2A/B01.tif',), 'r', (('sharing', False),), 'fafac692-0bb0-44ac-ac0d-b832f7d8002e']

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last) Cell In[17], line 4 1 import rioxarray 3 b01_href = assets["B01"].href ----> 4 b01 = rioxarray.open_rasterio(b01_href) 5 print(b01)

File ~/miniconda3/envs/bathy/lib/python3.9/site-packages/rioxarray/_io.py:1087, in open_rasterio(filename, parse_coordinates, chunks, cache, lock, masked, mask_and_scale, variable, group, default_name, decode_times, decode_timedelta, band_as_variable, **open_kwargs) 1085 else: ... 282 profile_name=profile_name) 284 self.requester_pays = requester_pays 285 self.unsigned = bool(os.getenv("AWS_NO_SIGN_REQUEST", aws_unsigned))

AttributeError: module 'boto3' has no attribute 'Session'

I tried to look for that error but found no promising results that could help. I am new to these concepts and may be missing some basic things. If anyone can help me, it would be very helpful for me. Thank you in advance. Girish

fnattino commented 1 year ago

Hi @GKG1312, sorry for the late reply! Could you please share the all the code that lead to your error so that we can try to reproduce? I have been running the code cells from episode 5 and it seems to work fine on my side?

rbavery commented 1 year ago

Also recommend to use the environment provided in the lesson. It looks like boto3 shouldn't have a session attribute, it should be boto3.session.Session used internally by rioxarray https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html.

so maybe this would be solved by updating packages?

rbavery commented 1 year ago

Closing, but feel free to open if you still think there's an issue