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

psutil compatibility with linux subsystem for windows #1218

Closed
hoppushoppard opened this issue Feb 15, 2018 · 6 comments
Closed

psutil compatibility with linux subsystem for windows #1218

hoppushoppard opened this issue Feb 15, 2018 · 6 comments

Comments

@hoppushoppard
Copy link

Running glances on ubuntu in linux subsystem for windows I get several errors.
Apparently there is no /proc/vmstat, no /etc/mtab.

glances is using psutil

~⟫ glances
/usr/local/lib/python2.7/dist-packages/psutil/_pslinux.py:515: RuntimeWarning: 'sin' and 'sout' swap memory stats couldn't be determined and were set to 0 ([Errno 2] No such file or directory: '/proc/vmstat')
  warnings.warn(msg, RuntimeWarning)
Traceback (most recent call last):
  File "/usr/local/bin/glances", line 9, in <module>
    load_entry_point('Glances==2.10', 'console_scripts', 'glances')()
  File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 134, in main
    start(config=config, args=args)
  File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 100, in start
    mode = GlancesMode(config=config, args=args)
  File "/usr/local/lib/python2.7/dist-packages/glances/standalone.py", line 69, in __init__
    self.stats.update()
  File "/usr/local/lib/python2.7/dist-packages/glances/stats.py", line 192, in update
    self._plugins[p].update()
  File "/usr/local/lib/python2.7/dist-packages/glances/plugins/glances_plugin.py", line 882, in wrapper
    ret = fct(self, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/glances/plugins/glances_plugin.py", line 891, in wrapper
    ret = fct(*args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/glances/plugins/glances_fs.py", line 106, in update
    fs_stat = psutil.disk_partitions(all=False)
  File "/usr/local/lib/python2.7/dist-packages/psutil/__init__.py", line 1979, in disk_partitions
    return _psplatform.disk_partitions(all)
  File "/usr/local/lib/python2.7/dist-packages/psutil/_pslinux.py", line 1102, in disk_partitions
    partitions = cext.disk_partitions()
OSError: [Errno 2] No such file or directory: '/etc/mtab'

Installed psutil version

~⟫ pip show psutil
Name: psutil
Version: 5.4.3
Summary: Cross-platform lib for process and system monitoring in Python.
Home-page: https://github.com/giampaolo/psutil
Author: Giampaolo Rodola
Author-email: g.rodola@gmail.com
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires:

Installed glances version

~⟫ glances -V
Glances v2.10 with psutil v5.4.3
@giampaolo
Copy link
Owner

Sorry for the delay.

Running glances on ubuntu in linux subsystem for windows I get several errors.

What kind of platform is that?

@hoppushoppard
Copy link
Author

From late 2017 you are able to install linux directly on Windows 10 machine
(https://docs.microsoft.com/en-us/windows/wsl/install-win10)

The distro could be one apparently one of these:

Ubuntu
OpenSUSE
SLES
Kali Linux
Debian GNU/Linux

I've got Ubuntu.

~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial
~$ uname -a
Linux [my pc name] 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

I'm sorry I don't understand your question regarding platform 😅 .
Is there any command I could run to help you investigate ?

@giampaolo
Copy link
Owner

I've never played with that configuration so it's likely psutil won't work. I would welcome adding support for it though (PRs are welcome =)).

@giampaolo
Copy link
Owner

I opened a ticket for this: #1251

@hoppushoppard
Copy link
Author

Thanks !
Sadly I'm not familiar with Python :(.
Right now it's not a big issue for me, so I'll wait for that ticket :)

@drtitus
Copy link

drtitus commented Jan 4, 2019

You can symlink /proc/mounts to /etc/mtab (sudo ln -s /proc/mounts /etc/mtab) and then in the /usr/lib/python3/dist-packages/psutil/_pslinux.py file, you can comment out the line (put a # before it) that spits out the warning from not finding vmstat - this ends up setting the values to 0, and not spew out the RuntimeWarning that messes up the display. In my version it was line 470, but YMMV based on the version of psutil. Hint: it's the line mentioned in the RuntimeWarning - in your case, line 515.

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

No branches or pull requests

3 participants