nicolargo/glances

Glances cannot start in web server mode in MacOS

Closed this issue · 0 comments

After installing on my macbook pro using homebrew, I get the following error when starting the web server:

% glances -w
FastAPI import error: No module named 'fastapi'
Glances cannot start in web server mode.

I've also installed FastAPI via homebrew, but it has no effect.

Steps to reproduce the behavior:

  1. Install glances via homebrew: brew install glances
  2. Run glances in web server mode: glances -w
  3. See above error

Expected behavior
Glances to run out of the box in webserver mode, and to find the fastapi dependency correctly.

Environment (please complete the following information)

  • Operating System: MacOS Sonoma 14.7
  • Glances & psutil versions: Glances version: 4.2.1, Glances API version: 4, PsUtil version: 6.1.0
  • How do you install Glances: brew install glances
  • Glances test:
% glances --issue
===============================================================================
Glances 4.2.1 (/usr/local/Cellar/glances/4.2.1/libexec/lib/python3.13/site-packages/glances/__init__.py)
Python 3.13.0 (/usr/local/Cellar/glances/4.2.1/libexec/bin/python)
PsUtil 6.1.0 (/usr/local/Cellar/glances/4.2.1/libexec/lib/python3.13/site-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00003s
[]
amps          [OK]    0.00007s
[]
cloud         [OK]    0.00003s
{}
connections   [OK]    0.00161s
{'net_connections_enabled': False, 'nf_conntrack_enabled': True}
containers    [OK]    0.00004s
{}
core          [OK]    0.00011s
{'log': 16, 'phys': 8}
cpu           [OK]    0.00037s
{'cpucore': 16,
 'ctx_switches': 0,
 'ctx_switches_gauge': 1425585,
 'idle': 94.6,
 'interrupts': 0,
 'interrupts_gauge': 902618,
 'nice': 0.0,
 'soft_interrupts': 0,
 'soft_interrupts_gauge': 484714145,
 'syscalls': 0,
 'syscalls_gauge': 2883118,
 'system': 2.0,
 'time_since_update': 2.2612040042877197,
 'total': 5.4,
 'user': 3.4}
diskio        [OK]    0.00081s key=disk_name
[{'disk_name': 'disk0',
  'key': 'disk_name',
  'read_bytes': 0,
  'read_bytes_gauge': 138288254976,
  'read_count': 0,
  'read_count_gauge': 9534664,
  'time_since_update': 2.2633159160614014,
  'write_bytes': 0,
  'write_bytes_gauge': 68145606656,
  'write_count': 0,
  'write_count_gauge': 2354245}, ...]
folders       [OK]    0.00003s
[]
fs            [OK]    0.00042s key=mnt_point
[{'device_name': '/dev/disk1s1s1',
  'free': 632879472640,
  'fs_type': 'apfs',
  'key': 'mnt_point',
  'mnt_point': '/',
  'percent': 1.7,
  'size': 2000796545024,
  'used': 11016282112}, ...]
gpu           [OK]    0.00005s
[]
help          [OK]    0.00000s
None
ip            [OK]    0.00003s
{}
irq           [OK]    0.00003s
[]
load          [OK]    0.00004s
{'cpucore': 16, 'min1': 3.34619140625, 'min15': 3.232421875, 'min5': 3.3046875}
mem           [OK]    0.00007s
{'active': 12509188096,
 'available': 17648484352,
 'free': 17648484352,
 'inactive': 11809251328,
 'percent': 48.6,
 'total': 34359738368,
 'used': 16711254016,
 'wired': 3697123328}
memswap       [OK]    0.00008s
{'free': 1000341504,
 'percent': 6.8,
 'sin': 48446193664,
 'sout': 38977536,
 'time_since_update': 2.2674050331115723,
 'total': 1073741824,
 'used': 73400320}
network       [OK]    0.00272s key=interface_name
[{'alias': None,
  'bytes_all': 4096,
  'bytes_all_gauge': 2428870656,
  'bytes_all_rate_per_sec': 2035.0,
  'bytes_recv': 2048,
  'bytes_recv_gauge': 1214435328,
  'bytes_recv_rate_per_sec': 1017.0,
  'bytes_sent': 2048,
  'bytes_sent_gauge': 1214435328,
  'bytes_sent_rate_per_sec': 1017.0,
  'interface_name': 'lo0',
  'key': 'interface_name',
  'speed': 0,
  'time_since_update': 2.012133836746216}, ...]
now           [OK]    0.00004s
{'custom': '2024-11-09 14:39:17 PST', 'iso': '2024-11-09T14:39:17-08:00'}
percpu        [OK]    0.00039s key=cpu_number
[{'cpu_number': 0,
  'dpc': None,
  'guest': None,
  'guest_nice': None,
  'idle': 77.3,
  'interrupt': None,
  'iowait': None,
  'irq': None,
  'key': 'cpu_number',
  'nice': 0.0,
  'softirq': None,
  'steal': None,
  'system': 8.9,
  'total': 22.7,
  'user': 13.8}, ...]
ports         [OK]    0.00023s
[]
processcount  [OK]    0.13055s
{'pid_max': 0, 'running': 690, 'sleeping': 0, 'thread': 2438, 'total': 690}
processlist   [OK]    0.00057s
[]
psutilversion [OK]    0.00005s
'6.1.0'
quicklook     [OK]    0.00026s
{'cpu': 5.4,
 'cpu_hz': 2400000000.0,
 'cpu_hz_current': 2400000000.0,
 'cpu_log_core': 16,
 'cpu_name': 'CPU',
 'cpu_phys_core': 8,
 'load': 20.2,
 'mem': 48.6,
 'percpu': [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...},
            {...}],
 'swap': 6.8}
raid          [OK]    0.00003s
{}
sensors       [OK]    0.00001s key=label
[{'key': 'label',
  'label': 'Battery',
  'status': 'Charging',
  'type': <SensorType.BATTERY: 'battery'>,
  'unit': '%',
  'value': 100}, ...]
smart         [NA]
system        [OK]    0.00001s
{'hostname': 'REMOVED',
 'hr_name': 'Darwin 14.7 64bit',
 'os_name': 'Darwin',
 'os_version': '14.7',
 'platform': '64bit'}
uptime        [OK]    0.00005s
{'seconds': 159126}
version       [OK]    0.00002s
'4.2.1'
vms           [OK]    0.00005s
[]
wifi          [OK]    0.00002s
[]
===============================================================================
Total time to update all stats: 0.14226s
===============================================================================

Additional context
FastAPI was also installed via HomeBrew:

% fastapi --version
FastAPI CLI version: 0.0.5

There is no configuration file. The log file only contains these lines repeated for each time I tried to launch with -w:

2024-11-09 14:42:38,577 -- INFO -- Start Glances 4.2.1
2024-11-09 14:42:38,578 -- INFO -- CPython 3.13.0 (/usr/local/Cellar/glances/4.2.1/libexec/bin/python) and psutil 6.1.0 detected
2024-11-09 14:42:38,592 -- CRITICAL -- FastAPI import error: No module named 'fastapi'
2024-11-09 14:42:38,592 -- CRITICAL -- Glances cannot start in web server mode.