amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

AttributeError: module 'aiobotocore' has no attribute 'AioSession'[Bug Report]

Open pomcho555 opened this issue 2 years ago • 0 comments

Link to the notebook https://github.com/aws/amazon-sagemaker-examples/blob/main/advanced_functionality/autogluon-tabular-containers/AutoGluon_Tabular_SageMaker_Containers.ipynb

Describe the bug While running below cell, I had AttributeError in example notebook. This is because probably SageMaker depends old versionon of aiobotocore.

df_train = pd.read_csv(
    "s3://sagemaker-sample-files/datasets/tabular/uci_adult/adult.data", header=None
)

To reproduce Run the link notebook with SageMaker notebook: conda_mxnet_p37

Logs

error trace
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-1d920209ee10> in <module>
      1 df_train = pd.read_csv(
----> 2     "s3://sagemaker-sample-files/datasets/tabular/uci_adult/adult.data", header=None
      3 )
      4 df_train.columns = columns
      5 df_train.to_csv("data/train.csv")

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/parsers.py in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)
    608     kwds.update(kwds_defaults)
    609 
--> 610     return _read(filepath_or_buffer, kwds)
    611 
    612 

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
    460 
    461     # Create the parser.
--> 462     parser = TextFileReader(filepath_or_buffer, **kwds)
    463 
    464     if chunksize or iterator:

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/parsers.py in __init__(self, f, engine, **kwds)
    817             self.options["has_index_names"] = kwds["has_index_names"]
    818 
--> 819         self._engine = self._make_engine(self.engine)
    820 
    821     def close(self):

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/parsers.py in _make_engine(self, engine)
   1048             )
   1049         # error: Too many arguments for "ParserBase"
-> 1050         return mapping[engine](self.f, **self.options)  # type: ignore[call-arg]
   1051 
   1052     def _failover_to_python(self):

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
   1865 
   1866         # open handles
-> 1867         self._open_handles(src, kwds)
   1868         assert self.handles is not None
   1869         for key in ("storage_options", "encoding", "memory_map", "compression"):

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/parsers.py in _open_handles(self, src, kwds)
   1366             compression=kwds.get("compression", None),
   1367             memory_map=kwds.get("memory_map", False),
-> 1368             storage_options=kwds.get("storage_options", None),
   1369         )
   1370 

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
    561         compression=compression,
    562         mode=mode,
--> 563         storage_options=storage_options,
    564     )
    565 

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/pandas/io/common.py in _get_filepath_or_buffer(filepath_or_buffer, encoding, compression, mode, storage_options)
    332         try:
    333             file_obj = fsspec.open(
--> 334                 filepath_or_buffer, mode=fsspec_mode, **(storage_options or {})
    335             ).open()
    336         # GH 34626 Reads from Public Buckets without Credentials needs anon=True

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/core.py in open(urlpath, mode, compression, encoding, errors, protocol, newline, **kwargs)
    436         newline=newline,
    437         expand=False,
--> 438         **kwargs,
    439     )[0]
    440 

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/core.py in open_files(urlpath, mode, compression, encoding, errors, name_function, num, protocol, newline, auto_mkdir, expand, **kwargs)
    285         storage_options=kwargs,
    286         protocol=protocol,
--> 287         expand=expand,
    288     )
    289     if "r" not in mode and auto_mkdir:

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/core.py in get_fs_token_paths(urlpath, mode, num, name_function, storage_options, protocol, expand)
    608             )
    609         update_storage_options(options, storage_options)
--> 610         fs = cls(**options)
    611         paths = expand_paths_if_needed(paths, mode, num, fs, name_function)
    612 

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/spec.py in __call__(cls, *args, **kwargs)
     64             return cls._cache[token]
     65         else:
---> 66             obj = super().__call__(*args, **kwargs)
     67             # Setting _fs_token here causes some static linters to complain.
     68             obj._fs_token_ = token

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/s3fs/core.py in __init__(self, anon, key, secret, token, use_ssl, client_kwargs, requester_pays, default_block_size, default_fill_cache, default_cache_type, version_aware, config_kwargs, s3_additional_kwargs, session, username, password, asynchronous, loop, **kwargs)
    211         self.use_ssl = use_ssl
    212         if not asynchronous:
--> 213             self.connect()
    214             weakref.finalize(self, sync, self.loop, self._s3.close)
    215         else:

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/asyn.py in wrapper(*args, **kwargs)
    119     def wrapper(*args, **kwargs):
    120         self = obj or args[0]
--> 121         return maybe_sync(func, self, *args, **kwargs)
    122 
    123     return wrapper

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/asyn.py in maybe_sync(func, self, *args, **kwargs)
     98         if inspect.iscoroutinefunction(func):
     99             # run the awaitable on the loop
--> 100             return sync(loop, func, *args, **kwargs)
    101         else:
    102             # just call the blocking function

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/asyn.py in sync(loop, func, callback_timeout, *args, **kwargs)
     69     if error[0]:
     70         typ, exc, tb = error[0]
---> 71         raise exc.with_traceback(tb)
     72     else:
     73         return result[0]

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/fsspec/asyn.py in f()
     53             if callback_timeout is not None:
     54                 future = asyncio.wait_for(future, callback_timeout)
---> 55             result[0] = await future
     56         except Exception:
     57             error[0] = sys.exc_info()

~/anaconda3/envs/mxnet_p37/lib/python3.7/site-packages/s3fs/core.py in _connect(self, kwargs)
    359         conf = AioConfig(**config_kwargs)
    360         if self.session is None:
--> 361             self.session = aiobotocore.AioSession(**self.kwargs)
    362         s3creator = self.session.create_client(
    363             "s3", config=conf, **init_kwargs, **client_kwargs

AttributeError: module 'aiobotocore' has no attribute 'AioSession'

pomcho555 avatar Jul 31 '22 09:07 pomcho555