Add support for WSL "Windows Subsystem for Linux"
Opened this issue · 3 comments
giampaolo commented
This basically would mean adding support for a new OS/platform
https://docs.microsoft.com/en-us/windows/wsl/install-win10
Ashafix commented
What would full support mean?
- Sensors is not really an option because WSL cannot access most of the hardware directly.
- Processes can be listed with psutil but their status looks different than on Linux.
- CPU stats look OK
psutil.disk_partitions()
gives an empty list
rchateauneu commented
PsutilProcConnections.connections returns this error:
survol/lib_psutil.py:100: in PsutilProcConnections
return proc.connections(kind)
/home/rchateau/.local/lib/python3.8/site-packages/psutil/__init__.py:1162: in connections
return self._proc.connections(kind)
/home/rchateau/.local/lib/python3.8/site-packages/psutil/_pslinux.py:1576: in wrapper
return fun(self, *args, **kwargs)
/home/rchateau/.local/lib/python3.8/site-packages/psutil/_pslinux.py:2132: in connections
ret = _connections.retrieve(kind, self.pid)
/home/rchateau/.local/lib/python3.8/site-packages/psutil/_pslinux.py:1011: in retrieve
for fd, family, type_, laddr, raddr, status, bound_pid in ls:
/home/rchateau/.local/lib/python3.8/site-packages/psutil/_pslinux.py:955: in process_unix
with open_text(file, buffering=BIGFILE_BUFFERING) as f:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fname = '/proc/net/unix', kwargs = {'buffering': -1, 'encoding': 'utf-8', 'errors': 'surrogateescape'}
def open_text(fname, **kwargs):
"""On Python 3 opens a file in text mode by using fs encoding and
a proper en/decoding errors handler.
On Python 2 this is just an alias for open(name, 'rt').
"""
if PY3:
# See:
# https://github.com/giampaolo/psutil/issues/675
# https://github.com/giampaolo/psutil/pull/733
kwargs.setdefault('encoding', ENCODING)
kwargs.setdefault('errors', ENCODING_ERRS)
> return open(fname, "rt", **kwargs)
E FileNotFoundError: [Errno 2] No such file or directory: '/proc/net/unix'
$ python3 --version
Python 3.8.5
$ python3 -c "import psutil;print(psutil.__version__)"
5.8.0
Vexed01 commented
Looking like a relatively similar path issue as the comment above, CPU frequencies also appear to be broken on WSL:
Exception in command 'system top'
Traceback (most recent call last):
File "/home/vex/redenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/mnt/c/Data/Git/Vex-Cogs/system/system.py", line 339, in system_all
cpu = await get_cpu()
File "/mnt/c/Data/Git/Vex-Cogs/system/utils.py", line 37, in get_cpu
freq = psutil.cpu_freq(percpu=True)
File "/home/vex/.local/share/Red-DiscordBot/data/dev/cogs/Downloader/lib/psutil/__init__.py", line 1859, in cpu_freq
ret = _psplatform.cpu_freq()
File "/home/vex/.local/share/Red-DiscordBot/data/dev/cogs/Downloader/lib/psutil/_pslinux.py", line 748, in cpu_freq
raise NotImplementedError(
NotImplementedError: can't find current frequency file
64-bit Python 3.8.5
psutil 5.8.0
I've also noticed that psutil.users()
returns none, though not so much of an issue as there's no error