Skip to content

AttributeError: module 'jupyter_core' has no attribute '__version__' although in excludes

Hi,

I'm calling session info like:

    session_info.show(
        dependencies=True,
        html=False,
        excludes=[
            "builtins",
            "stdlib_list",
            "importlib_metadata",
            "jupyter_core"
            # Special module present if test coverage being calculated
            # https://gitlab.com/joelostblom/session_info/-/issues/10
            "$coverage",
        ],
    )

However, it runs into

AttributeError Traceback (most recent call last) Cell In[3], line 1 ----> 1 ep.print_versions()

File /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/ehrapy/core/meta_information.py:20, in print_versions() 13 def print_versions(): # pragma: no cover 14 """Print print versions of imported packages. 15 16 Examples: 17 >>> import ehrapy as ep 18 >>> ep.print_versions() 19 """ ---> 20 session_info.show( 21 dependencies=True, 22 html=False, 23 excludes=[ 24 "builtins", 25 "stdlib_list", 26 "importlib_metadata", 27 "jupyter_core" 28 # Special module present if test coverage being calculated 29 # #10

 30             "$coverage",
 31         ],
 32     )

File /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/session_info/main.py:169, in show(na, os, cpu, jupyter, dependencies, std_lib, private, write_req_file, req_file_name, html, excludes) 165 pass 166 # The length of 'jupyter_client' is 14 167 # The spaces are added to create uniform whitespace in the output 168 # f-strings, which is needed to clean them with inspect.cleandoc --> 169 jup_mod_and_ver = [f' {module.name:14}\t{module.version}' 170 for module in jup_modules] 171 output_jupyter = '\n'.join(jup_mod_and_ver) 172 else:

File /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/session_info/main.py:169, in (.0) 165 pass 166 # The length of 'jupyter_client' is 14 167 # The spaces are added to create uniform whitespace in the output 168 # f-strings, which is needed to clean them with inspect.cleandoc --> 169 jup_mod_and_ver = [f' {module.name:14}\t{module.version}' 170 for module in jup_modules] 171 output_jupyter = '\n'.join(jup_mod_and_ver) 172 else:

AttributeError: module 'jupyter_core' has no attribute 'version'

which I thought shouldn't be possible due to exclude?