session-info2¶
cli¶
!session-info -h
usage: session-info [-h] [--os | --no-os] [--cpu | --no-cpu] [--gpu | --no-gpu]
[--dependencies | --no-dependencies] [-f {text,markdown,html,json}]
[packages ...]
positional arguments:
packages packages to import
options:
-h, --help show this help message and exit
--os, --no-os include OS name and version
--cpu, --no-cpu include number of CPU cores
--gpu, --no-gpu include information per supported GPU (disabled by default)
--dependencies, --no-dependencies
include dependencies
-f, --format {text,markdown,html,json}
output format
!session-info --no-dependencies ipykernel
ipykernel 7.2.0
---- ----
Python 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0]
OS Linux-6.17.0-1007-aws-x86_64-with-glibc2.39
CPU 2/2 logical CPU cores, x86_64
Updated 2026-04-08 11:30
programmatic use¶
Start by importing the main function and calling it:
from session_info2 import session_info
session_info() # note that the “copy” button only works in a live notebook
/tmp/ipykernel_1317/3496285662.py:1: RuntimeWarning: Failed to import dependencies for application/vnd.jupyter.widget-view+json representation. (ModuleNotFoundError: No module named 'ipywidgets')
session_info() # note that the “copy” button only works in a live notebook
| Component | Info |
|---|---|
| Python | 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] |
| OS | Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 |
| Updated | 2026-04-08 11:30 |
Dependencies
| Dependency | Version |
|---|---|
| Pygments | 2.20.0 |
| platformdirs | 4.9.4 |
| psutil | 7.2.2 |
| wcwidth | 0.6.0 |
| python-dateutil | 2.9.0.post0 |
| ptyprocess | 0.7.0 |
| decorator | 5.2.1 |
| stack-data | 0.6.3 |
| executing | 2.2.1 |
| ipython | 9.12.0 |
| jupyter_client | 8.8.0 |
| traitlets | 5.14.3 |
| parso | 0.8.6 |
| pyzmq | 27.1.0 |
| six | 1.17.0 |
| pure_eval | 0.2.3 |
| jupyter_core | 5.9.1 |
| asttokens | 3.0.1 |
| ipykernel | 7.2.0 |
| jedi | 0.19.2 |
| pexpect | 4.9.0 |
| debugpy | 1.8.20 |
| tornado | 6.5.5 |
| prompt_toolkit | 3.0.52 |
| packaging | 26.0 |
| session-info2 | 0.4.1 |
| comm | 0.2.3 |
Copyable Markdown
| Dependency | Version | | --------------- | ----------- | | Pygments | 2.20.0 | | platformdirs | 4.9.4 | | psutil | 7.2.2 | | wcwidth | 0.6.0 | | python-dateutil | 2.9.0.post0 | | ptyprocess | 0.7.0 | | decorator | 5.2.1 | | stack-data | 0.6.3 | | executing | 2.2.1 | | ipython | 9.12.0 | | jupyter_client | 8.8.0 | | traitlets | 5.14.3 | | parso | 0.8.6 | | pyzmq | 27.1.0 | | six | 1.17.0 | | pure_eval | 0.2.3 | | jupyter_core | 5.9.1 | | asttokens | 3.0.1 | | ipykernel | 7.2.0 | | jedi | 0.19.2 | | pexpect | 4.9.0 | | debugpy | 1.8.20 | | tornado | 6.5.5 | | prompt_toolkit | 3.0.52 | | packaging | 26.0 | | session-info2 | 0.4.1 | | comm | 0.2.3 | | Component | Info | | --------- | ------------------------------------------------- | | Python | 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] | | OS | Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 | | Updated | 2026-04-08 11:30 |
If you call it while some packages are in scope, you should see them appear in the list:
session_info()
/tmp/ipykernel_1317/1880913108.py:1: RuntimeWarning: Failed to import dependencies for application/vnd.jupyter.widget-view+json representation. (ModuleNotFoundError: No module named 'ipywidgets')
session_info()
| Component | Info |
|---|---|
| Python | 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] |
| OS | Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 |
| Updated | 2026-04-08 11:30 |
Dependencies
| Dependency | Version |
|---|---|
| Pygments | 2.20.0 |
| platformdirs | 4.9.4 |
| psutil | 7.2.2 |
| wcwidth | 0.6.0 |
| python-dateutil | 2.9.0.post0 |
| ptyprocess | 0.7.0 |
| decorator | 5.2.1 |
| stack-data | 0.6.3 |
| executing | 2.2.1 |
| ipython | 9.12.0 |
| jupyter_client | 8.8.0 |
| traitlets | 5.14.3 |
| parso | 0.8.6 |
| pyzmq | 27.1.0 |
| six | 1.17.0 |
| pure_eval | 0.2.3 |
| jupyter_core | 5.9.1 |
| asttokens | 3.0.1 |
| ipykernel | 7.2.0 |
| jedi | 0.19.2 |
| pexpect | 4.9.0 |
| debugpy | 1.8.20 |
| tornado | 6.5.5 |
| prompt_toolkit | 3.0.52 |
| packaging | 26.0 |
| session-info2 | 0.4.1 |
| comm | 0.2.3 |
Copyable Markdown
| Dependency | Version | | --------------- | ----------- | | Pygments | 2.20.0 | | platformdirs | 4.9.4 | | psutil | 7.2.2 | | wcwidth | 0.6.0 | | python-dateutil | 2.9.0.post0 | | ptyprocess | 0.7.0 | | decorator | 5.2.1 | | stack-data | 0.6.3 | | executing | 2.2.1 | | ipython | 9.12.0 | | jupyter_client | 8.8.0 | | traitlets | 5.14.3 | | parso | 0.8.6 | | pyzmq | 27.1.0 | | six | 1.17.0 | | pure_eval | 0.2.3 | | jupyter_core | 5.9.1 | | asttokens | 3.0.1 | | ipykernel | 7.2.0 | | jedi | 0.19.2 | | pexpect | 4.9.0 | | debugpy | 1.8.20 | | tornado | 6.5.5 | | prompt_toolkit | 3.0.52 | | packaging | 26.0 | | session-info2 | 0.4.1 | | comm | 0.2.3 | | Component | Info | | --------- | ------------------------------------------------- | | Python | 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] | | OS | Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 | | Updated | 2026-04-08 11:30 |
In environments where ipywidgets is not available, you will see the HTML version of the output instead:
from IPython.display import HTML
HTML(session_info()._repr_mimebundle_()["text/html"])
/home/docs/.local/share/hatch/env/virtual/session-info2/pWdOFpCL/notebook/lib/python3.14/site-packages/IPython/core/interactiveshell.py:3169: RuntimeWarning: Failed to import dependencies for application/vnd.jupyter.widget-view+json representation. (ModuleNotFoundError: No module named 'ipywidgets')
result = self._run_cell(
| Component | Info |
|---|---|
| Python | 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] |
| OS | Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 |
| Updated | 2026-04-08 11:30 |
Dependencies
| Dependency | Version |
|---|---|
| Pygments | 2.20.0 |
| platformdirs | 4.9.4 |
| psutil | 7.2.2 |
| wcwidth | 0.6.0 |
| python-dateutil | 2.9.0.post0 |
| ptyprocess | 0.7.0 |
| decorator | 5.2.1 |
| stack-data | 0.6.3 |
| executing | 2.2.1 |
| ipython | 9.12.0 |
| jupyter_client | 8.8.0 |
| traitlets | 5.14.3 |
| parso | 0.8.6 |
| pyzmq | 27.1.0 |
| six | 1.17.0 |
| pure_eval | 0.2.3 |
| jupyter_core | 5.9.1 |
| asttokens | 3.0.1 |
| ipykernel | 7.2.0 |
| jedi | 0.19.2 |
| pexpect | 4.9.0 |
| debugpy | 1.8.20 |
| tornado | 6.5.5 |
| prompt_toolkit | 3.0.52 |
| packaging | 26.0 |
| session-info2 | 0.4.1 |
| comm | 0.2.3 |
Copyable Markdown
| Dependency | Version | | --------------- | ----------- | | Pygments | 2.20.0 | | platformdirs | 4.9.4 | | psutil | 7.2.2 | | wcwidth | 0.6.0 | | python-dateutil | 2.9.0.post0 | | ptyprocess | 0.7.0 | | decorator | 5.2.1 | | stack-data | 0.6.3 | | executing | 2.2.1 | | ipython | 9.12.0 | | jupyter_client | 8.8.0 | | traitlets | 5.14.3 | | parso | 0.8.6 | | pyzmq | 27.1.0 | | six | 1.17.0 | | pure_eval | 0.2.3 | | jupyter_core | 5.9.1 | | asttokens | 3.0.1 | | ipykernel | 7.2.0 | | jedi | 0.19.2 | | pexpect | 4.9.0 | | debugpy | 1.8.20 | | tornado | 6.5.5 | | prompt_toolkit | 3.0.52 | | packaging | 26.0 | | session-info2 | 0.4.1 | | comm | 0.2.3 | | Component | Info | | --------- | ------------------------------------------------- | | Python | 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] | | OS | Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 | | Updated | 2026-04-08 11:30 |
Compare the output with session-info:
import session_info as si
si.show()
Click to view session information
----- session_info v1.0.1 session_info2 NA -----
Click to view modules imported as dependencies
asttokens NA comm 0.2.3 cython_runtime NA dateutil 2.9.0.post0 debugpy 1.8.20 decorator 5.2.1 executing 2.2.1 ipykernel 7.2.0 jedi 0.19.2 packaging 26.0 parso 0.8.6 pexpect 4.9.0 platformdirs 4.9.4 prompt_toolkit 3.0.52 psutil 7.2.2 ptyprocess 0.7.0 pure_eval 0.2.3 pydev_ipython NA pydevconsole NA pydevd 3.2.3 pydevd_file_utils NA pydevd_plugins NA pydevd_tracing NA pygments 2.20.0 six 1.17.0 stack_data 0.6.3 tornado 6.5.5 traitlets 5.14.3 wcwidth 0.6.0 zmq 27.1.0
----- IPython 9.12.0 jupyter_client 8.8.0 jupyter_core 5.9.1 ----- Python 3.14.0 (main, Mar 19 2026, 17:06:41) [GCC 13.2.0] Linux-6.17.0-1007-aws-x86_64-with-glibc2.39 ----- Session information updated at 2026-04-08 11:30