https://github.com/pandas-dev/pandas/runs/4101565310?check_suite_focus=true

>>>-------------------------------------------------------------------------
Exception in /home/runner/work/pandas/pandas/doc/source/user_guide/io.rst at block ending on line 3032
Specify :okexcept: as an option in the ipython:: block to suppress this message
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-331-4c4d77530df1> in <module>
----> 1 df = pd.read_xml(
      2     "s3://irs-form-990/201923199349319487_public.xml",
      3     xpath=".//irs:Form990PartVIISectionAGrp",
      4     namespaces={"irs": "http://www.irs.gov/efile"}
      5 )

~/work/pandas/pandas/pandas/io/xml.py in read_xml(path_or_buffer, xpath, namespaces, elems_only, attrs_only, names, encoding, parser, stylesheet, compression, storage_options)
    921     """
    922 
--> 923     return _parse(
    924         path_or_buffer=path_or_buffer,
    925         xpath=xpath,

~/work/pandas/pandas/pandas/io/xml.py in _parse(path_or_buffer, xpath, namespaces, elems_only, attrs_only, names, encoding, parser, stylesheet, compression, storage_options, **kwargs)
    722         raise ValueError("Values for parser can only be lxml or etree.")
    723 
--> 724     data_dicts = p.parse_data()
    725 
    726     return _data_to_frame(data=data_dicts, **kwargs)

~/work/pandas/pandas/pandas/io/xml.py in parse_data(self)
    387         from lxml.etree import XML
    388 
--> 389         self.xml_doc = XML(self._parse_doc(self.path_or_buffer))
    390 
    391         if self.stylesheet is not None:

~/work/pandas/pandas/pandas/io/xml.py in _parse_doc(self, raw_doc)
    536         )
    537 
--> 538         handle_data = get_data_from_filepath(
    539             filepath_or_buffer=raw_doc,
    540             encoding=self.encoding,

~/work/pandas/pandas/pandas/io/xml.py in get_data_from_filepath(filepath_or_buffer, encoding, compression, storage_options)
    599         or file_exists(filepath_or_buffer)
    600     ):
--> 601         with get_handle(
    602             filepath_or_buffer,
    603             "r",

~/work/pandas/pandas/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
    606 
    607     # open URLs
--> 608     ioargs = _get_filepath_or_buffer(
    609         path_or_buf,
    610         encoding=encoding,

~/work/pandas/pandas/pandas/io/common.py in _get_filepath_or_buffer(filepath_or_buffer, encoding, compression, mode, storage_options)
    354 
    355         try:
--> 356             file_obj = fsspec.open(
    357                 filepath_or_buffer, mode=fsspec_mode, **(storage_options or {})
    358             ).open()

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/core.py in open(self)
    133         been deleted; but a with-context is better style.
    134         """
--> 135         out = self.__enter__()
    136         closer = out.close
    137         fobjects = self.fobjects.copy()[:-1]

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/core.py in __enter__(self)
    100         mode = self.mode.replace("t", "").replace("b", "") + "b"
    101 
--> 102         f = self.fs.open(self.path, mode=mode)
    103 
    104         self.fobjects = [f]

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/spec.py in open(self, path, mode, block_size, cache_options, **kwargs)
    974         else:
    975             ac = kwargs.pop("autocommit", not self._intrans)
--> 976             f = self._open(
    977                 path,
    978                 mode=mode,

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/s3fs/core.py in _open(self, path, mode, block_size, acl, version_id, fill_cache, cache_type, autocommit, requester_pays, **kwargs)
    532             cache_type = self.default_cache_type
    533 
--> 534         return S3File(
    535             self,
    536             path,

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/s3fs/core.py in __init__(self, s3, path, mode, block_size, acl, version_id, fill_cache, s3_additional_kwargs, autocommit, cache_type, requester_pays)
   1821                 self.details = s3.info(path)
   1822                 self.version_id = self.details.get("VersionId")
-> 1823         super().__init__(
   1824             s3, path, mode, block_size, autocommit=autocommit, cache_type=cache_type
   1825         )

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/spec.py in __init__(self, fs, path, mode, block_size, autocommit, cache_type, cache_options, **kwargs)
   1302         if mode == "rb":
   1303             if not hasattr(self, "details"):
-> 1304                 self.details = fs.info(path)
   1305             self.size = self.details["size"]
   1306             self.cache = caches[cache_type](

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/asyn.py in wrapper(*args, **kwargs)
     86     def wrapper(*args, **kwargs):
     87         self = obj or args[0]
---> 88         return sync(self.loop, func, *args, **kwargs)
     89 
     90     return wrapper

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/asyn.py in sync(loop, func, timeout, *args, **kwargs)
     67         raise FSTimeoutError
     68     if isinstance(result[0], BaseException):
---> 69         raise result[0]
     70     return result[0]
     71 

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/fsspec/asyn.py in _runner(event, coro, result, timeout)
     23         coro = asyncio.wait_for(coro, timeout=timeout)
     24     try:
---> 25         result[0] = await coro
     26     except Exception as ex:
     27         result[0] = ex

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/s3fs/core.py in _info(self, path, bucket, key, refresh, version_id)
   1062                 else:
   1063                     try:
-> 1064                         out = await self._simple_info(path)
   1065                     except PermissionError:
   1066                         # If the permissions aren't enough for scanning a prefix

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/s3fs/core.py in _simple_info(self, path)
    975         prefix = key.strip("/")
    976 
--> 977         out = await self._call_s3(
    978             "list_objects_v2",
    979             self.kwargs,

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/s3fs/core.py in _call_s3(self, method, *akwarglist, **kwargs)
    235 
    236     async def _call_s3(self, method, *akwarglist, **kwargs):
--> 237         await self.set_session()
    238         s3 = await self.get_s3(kwargs.get("Bucket"))
    239         method = getattr(s3, method)

~/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/s3fs/core.py in set_session(self, refresh, kwargs)
    376 
    377         conf = AioConfig(**config_kwargs)
--> 378         self.session = aiobotocore.AioSession(**self.kwargs)
    379 
    380         for parameters in (config_kwargs, self.kwargs, init_kwargs, client_kwargs):

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

cc @pandas-dev/pandas-core

Comment From: jreback

I guess s3fs changed or incompatible with new aiobotocore.

cc @martindurant if any ideas.

Comment From: phofl

Probably incompatible. aiobotocore deprecated the AioSession object a few weeks ago, probably removed now.

Release Note of 2.0:

turn off default AIOBOTOCORE_DEPRECATED_1_4_0_APIS env var to match botocore module. See notes in 1.4.0.

Pinning to < 2.0 in s3fs should help

Comment From: jorisvandenbossche

It seems a fix for this was already released a while ago: https://github.com/fsspec/s3fs/issues/514 (so the question might then be why those builds don't get the latest s3fs version)

Comment From: phofl

Looks like s3fs requires aiobotocore~=1.4.1, which references 1.4.2 in this case and not 2.0. Looks like aiobotocore 2.0 is installed first and searches for the latest s3fs release without this clause, which seems to be 2021.07

Comment From: rhshadrach

Looks like docs build is now green, okay to close?

Comment From: phofl

No aiobotocore is pinned to lower than 2.0

Comment From: simonjayhawkins

Removing milestone here as not critical to fix for 1.3.x (or backport unpin).

Comment From: ParfaitG

I see this issue involves a read_xml run in IO tools docs to demonstrate an S3 bucket call. An :okwarning: was added to its ipython block. If resolved, should we close this issue? If needed, I can convert ipython block to code-block.

Comment From: phofl

We can close when we can unpin aiobotocore