Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while initializing the containers plugin ('type' object is not subscriptable) #2922

Closed
StitzL opened this issue Aug 16, 2024 · 1 comment · Fixed by #2923
Closed

Error while initializing the containers plugin ('type' object is not subscriptable) #2922

StitzL opened this issue Aug 16, 2024 · 1 comment · Fixed by #2923
Assignees

Comments

@StitzL
Copy link

StitzL commented Aug 16, 2024

Describe the bug
Using glances 4.1.2 on Python 3.8.10, I get following error message on startup:
Error while initializing the containers plugin ('type' object is not subscriptable)

To Reproduce

$ python --version
Python 3.8.10

$ glances 
Error while initializing the containers plugin ('type' object is not subscriptable)

Expected behavior
The containers plugin should be initialized correctly.

Environment

  • Operating System (lsb_release -a or OS name/version): Ubuntu 20.04.5 LTS
  • Glances & psutil versions:
Glances version:	4.1.2
PsUtil version:		6.0.0
  • How do you install Glances (Pypi package, script, package manager, source): pip install glances --upgrade
Collecting glances
  Downloading Glances-4.1.2-py3-none-any.whl (691 kB)
Requirement already satisfied, skipping upgrade: packaging in ~/.local/lib/python3.8/site-packages (from glances) (24.1)
Requirement already satisfied, skipping upgrade: defusedxml in ~/.local/lib/python3.8/site-packages (from glances) (0.7.1)
Collecting orjson
  Downloading orjson-3.10.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (141 kB)
Collecting psutil>=5.6.7
  Downloading psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (290 kB)
Installing collected packages: orjson, psutil, glances
Successfully installed glances-4.1.2 orjson-3.10.7 psutil-6.0.0
  • Glances test:
$ glances --issue
Error while initializing the containers plugin ('type' object is not subscriptable)
===============================================================================
Glances 4.1.2 (~/.local/lib/python3.8/site-packages/glances/__init__.py)
Python 3.8.10 (/usr/bin/python3)
PsUtil 6.0.0 (~/.local/lib/python3.8/site-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00002s 
[]
amps          [OK]    0.00009s 
[]
cloud         [OK]    0.00002s 
{'platform': 'OpenStack'}
connections   [OK]    0.03124s 
{'ESTABLISHED': 31,
 'LISTEN': 28,
 'SYN_RECV': 0,
 'SYN_SENT': 0,
 'initiated': 0,
 'net_connections_enabled': True,
 'nf_conntrack_count': 196.0,
 'nf_conntrack_enabled': True,
 'nf_conntrack_max': 262144.0,
 'nf_conntrack_percent': 0.07476806640625,
 'terminated': 0}
core          [OK]    0.00046s 
{'log': 8, 'phys': 8}
cpu           [OK]    0.00030s 
{'cpucore': 8,
 'ctx_switches': 0,
 'ctx_switches_gauge': 213186251583,
 'guest': 0.0,
 'idle': 55.7,
 'interrupts': 0,
 'interrupts_gauge': 22139065963,
 'iowait': 0.0,
 'irq': 0.0,
 'nice': 0.0,
 'soft_interrupts': 0,
 'soft_interrupts_gauge': 4240311033,
 'steal': 0.0,
 'syscalls': 0,
 'syscalls_gauge': 0,
 'system': 27.2,
 'time_since_update': 2.0410048961639404,
 'total': 45.8,
 'user': 16.5}
diskio        [OK]    0.00130s key=disk_name 
[{'disk_name': 'loop0',
  'key': 'disk_name',
  'read_bytes': 0,
  'read_bytes_gauge': 7168,
  'read_count': 0,
  'read_count_gauge': 10,
  'time_since_update': 2.039808988571167,
  'write_bytes': 0,
  'write_bytes_gauge': 0,
  'write_count': 0,
  'write_count_gauge': 0}, ...]
folders       [OK]    0.00004s 
[]
fs            [OK]    0.00077s key=mnt_point 
[{'device_name': '/dev/vda1',
  'free': 268927131648,
  'fs_type': 'ext4',
  'key': 'mnt_point',
  'mnt_point': '/',
  'percent': 48.3,
  'size': 520120602624,
  'used': 251176693760}, ...]
gpu           [OK]    0.00003s 
[]
help          [OK]    0.00000s 
None
ip            [OK]    0.00035s 
{'address': '***',
 'gateway': '***',
 'mask': '***',
 'mask_cidr': '***',
 'public_address': '***',
 'public_info_human': '***'}
irq           [OK]    0.00047s key=irq_line 
[{'irq_line': 'RES', 'irq_rate': 114288, 'key': 'irq_line', 'time_since_update': 2.047982931137085}, ...]
load          [OK]    0.00013s 
{'cpucore': 8, 'min1': 4.75, 'min15': 4.92, 'min5': 4.88}
mem           [OK]    0.00013s 
{'active': 21711056896,
 'available': 16886853632,
 'buffers': 329269248,
 'cached': 16651538432,
 'free': 16886853632,
 'inactive': 8810639360,
 'percent': 49.8,
 'shared': 306470912,
 'total': 33659621376,
 'used': 16772767744}
memswap       [OK]    0.00016s 
{'free': 7769088000,
 'percent': 9.6,
 'sin': 134115328,
 'sout': 1091387392,
 'time_since_update': 2.047102689743042,
 'total': 8589930496,
 'used': 820842496}
network       [OK]    0.00073s key=interface_name 
[{'alias': None,
  'bytes_all': 0,
  'bytes_all_gauge': 1132016,
  'bytes_all_rate_per_sec': 0.0,
  'bytes_recv': 0,
  'bytes_recv_gauge': 56,
  'bytes_recv_rate_per_sec': 0.0,
  'bytes_sent': 0,
  'bytes_sent_gauge': 1131960,
  'bytes_sent_rate_per_sec': 0.0,
  'interface_name': 'br-0cfda8e60dfd',
  'key': 'interface_name',
  'speed': 0,
  'time_since_update': 2.0438146591186523}, ...]
now           [OK]    0.00004s 
{'custom': '2024-08-16 10:32:54 CEST', 'iso': '2024-08-16T10:32:54+02:00'}
percpu        [OK]    0.00041s key=cpu_number 
[{'cpu_number': 0,
  'dpc': None,
  'guest': 0.0,
  'guest_nice': 0.0,
  'idle': 65.2,
  'interrupt': None,
  'iowait': 0.0,
  'irq': 0.0,
  'key': 'cpu_number',
  'nice': 0.0,
  'softirq': 3.6,
  'steal': 0.0,
  'system': 17.0,
  'total': 34.8,
  'user': 14.3}, ...]
ports         [OK]    0.00022s 
[]
processcount  [OK]    0.09620s 
{'pid_max': 0, 'running': 2, 'sleeping': 405, 'thread': 2248, 'total': 488}
processlist   [OK]    0.00030s 
[]
psutilversion [OK]    0.00003s 
'6.0.0'
quicklook     [OK]    0.00027s 
{'cpu': 45.8,
 'cpu_hz': 0.0,
 'cpu_hz_current': 2793436000.0000005,
 'cpu_log_core': 8,
 'cpu_name': 'Intel Core Processor (Broadwell, no TSX, IBRS)',
 'cpu_phys_core': 8,
 'load': 61.5,
 'mem': 49.8,
 'percpu': [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}],
 'swap': 9.6}
raid          [OK]    0.00002s 
{}
sensors       [OK]    0.00001s 
[]
smart         [NA]
system        [OK]    0.00000s 
{'hostname': 'vm78-136-224',
 'hr_name': 'Ubuntu 20.04 64bit / Linux 5.4.0-190-generic',
 'linux_distro': 'Ubuntu 20.04',
 'os_name': 'Linux',
 'os_version': '5.4.0-190-generic',
 'platform': '64bit'}
uptime        [OK]    0.00008s 
{'seconds': 1758753}
version       [OK]    0.00001s 
'4.1.2'
wifi          [OK]    0.00009s 
[]
===============================================================================
Total time to update all stats: 0.14131s
===============================================================================

Additional context
Glances log file:

2024-08-16 10:08:13,775 -- INFO -- Start Glances 4.1.2
2024-08-16 10:08:13,775 -- INFO -- CPython 3.8.10 (/usr/bin/python3) and psutil 6.0.0 detected
2024-08-16 10:08:13,788 -- WARNING -- Missing Python Lib (No module named 'pydantic'), EventList will be skipping data validation
2024-08-16 10:08:13,823 -- INFO -- Start GlancesStandalone mode
2024-08-16 10:08:13,929 -- WARNING -- Missing Python Lib (No module named 'pymdstat'), Raid plugin is disabled
2024-08-16 10:08:13,942 -- WARNING -- Sparklines module not found (No module named 'sparklines')
2024-08-16 10:08:13,943 -- WARNING -- Missing Python Lib (No module named 'pySMART'), HDD Smart plugin is disabled
2024-08-16 10:08:13,946 -- WARNING -- Missing Python Lib (No module named 'pynvml'), Nvidia GPU plugin is disabled
2024-08-16 10:08:13,950 -- CRITICAL -- Error while initializing the containers plugin ('type' object is not subscriptable)
2024-08-16 10:08:13,950 -- ERROR -- Traceback (most recent call last):
  File "~/.local/lib/python3.8/site-packages/glances/stats.py", line 100, in _load_plugin
    plugin = import_module('glances.plugins.' + plugin_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "~/.local/lib/python3.8/site-packages/glances/plugins/containers/__init__.py", line 16, in <module>
    from glances.plugins.containers.engines import ContainersExtension
  File "~/.local/lib/python3.8/site-packages/glances/plugins/containers/engines/__init__.py", line 4, in <module>
    class ContainersExtension(Protocol):
  File "~/.local/lib/python3.8/site-packages/glances/plugins/containers/engines/__init__.py", line 8, in ContainersExtension
    def update(self, all_tag) -> Tuple[Dict, list[Dict[str, Any]]]:
TypeError: 'type' object is not subscriptable
@nicolargo
Copy link
Owner

@RazCrimson can you have a look on this issue ? Thanks in advance !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants