joelostblom/session_info

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

Closed this issue · 1 comments

dlealv commented

Using session_info under jupyter lab I am getting the following error:

import importlib
if importlib.util.find_spec('session_info') is not None:
    ! pip install session_info --quiet
import session_info
session_info.show(write_req_file=True,
                  req_file_name= 'requirements.txt')

Here is the error code:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[56], line 5
      3     get_ipython().system(' pip install session_info --quiet')
      4 import session_info
----> 5 session_info.show(write_req_file=True,
      6                   req_file_name= 'requirements.txt')
      7 #!pip freeze > requirements-dev.txt # saves all packages in the environment
      8 # pip install -r requirements.txt # install packages from requirement file

File ~/.venv/titanic/lib/python3.12/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:

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

Here is the output of pip freeze, you can the the jupyter version

appnope==0.1.3
asttokens==2.4.1
beautifulsoup4==4.12.2
bleach==6.1.0
cachetools==5.3.2
certifi==2023.11.17
charset-normalizer==3.3.2
comm==0.2.0
contourpy==1.2.0
cycler==0.12.1
debugpy==1.8.0
decorator==5.1.1
executing==2.0.1
fonttools==4.47.0
google==3.0.0
google-api-core==2.15.0
google-api-python-client==2.111.0
google-auth==2.25.2
google-auth-httplib2==0.2.0
googleapis-common-protos==1.62.0
graphviz==0.20.1
httplib2==0.22.0
idna==3.6
ipykernel==6.27.1
ipython==8.18.1
jedi==0.19.1
joblib==1.3.2
jupyter_client==8.6.0
jupyter_core==5.5.1
kaggle==1.5.16
kiwisolver==1.4.5
matplotlib==3.8.2
matplotlib-inline==0.1.6
nest-asyncio==1.5.8
numpy==1.26.2
packaging==23.2
pandas==2.1.4
parso==0.8.3
pexpect==4.9.0
Pillow==10.1.0
platformdirs==4.1.0
prompt-toolkit==3.0.43
protobuf==4.25.1
psutil==5.9.7
ptyprocess==0.7.0
pure-eval==0.2.2
pyasn1==0.5.1
pyasn1-modules==0.3.0
Pygments==2.17.2
pyparsing==3.1.1
python-dateutil==2.8.2
python-slugify==8.0.1
pytz==2023.3.post1
pyzmq==25.1.2
requests==2.31.0
rsa==4.9
scikit-learn==1.3.2
scipy==1.11.4
seaborn==0.13.0
session-info==1.0.0
six==1.16.0
soupsieve==2.5
stack-data==0.6.3
stdlib-list==0.10.0
text-unidecode==1.3
threadpoolctl==3.2.0
tornado==6.4
tqdm==4.66.1
traitlets==5.14.0
tzdata==2023.3
uritemplate==4.1.1
urllib3==2.1.0
versioneer==0.29
wcwidth==0.2.12
webencodings==0.5.1

Thanks for any help

I'll close this in favor of the gitlab issue https://gitlab.com/joelostblom/session_info/-/issues/14