Skip to content

psutil version limitations #6758

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

Closed
crusaderky opened this issue May 3, 2019 · 5 comments · Fixed by #6762
Closed

psutil version limitations #6758

crusaderky opened this issue May 3, 2019 · 5 comments · Fixed by #6762

Comments

@crusaderky
Copy link
Contributor

#4130 by @gvanrossum, in Oct 2017, added a dependency to psutil >= 5.4.0 < 5.5.0. From git blame I see how the psutil dependency has since been made optional, but the version boundaries have never been touched and I can't find any reasoning behind them.

The only place I could find where psutil is used is:

mypy/mypy/dmypy_server.py

Lines 568 to 573 in d387906

process = psutil.Process(os.getpid())
meminfo = process.memory_info()
res['memory_rss_mib'] = meminfo.rss / MiB
res['memory_vms_mib'] = meminfo.vms / MiB
if sys.platform == 'win32':
res['memory_maxrss_mib'] = meminfo.peak_wset / MiB

I just tested the above code snippet on the following anaconda setups, and they all worked fine:

  • Linux, python=3.5.0, psutil=4.0.0
  • Linux, python=3.7.3, psutil=5.6.2
  • Windows 10, python=3.5.0, psutil=4.0.0
  • Windows 10, python=3.7.3, psutil=5.6.2

From my tests it looks like peak_wset was added in psutil 4.0, even if it's not mentioned in the changelog https://github.com/giampaolo/psutil/blob/master/HISTORY.rst.

Any objections to changing the dependency to psutil >= 4.0?

@gvanrossum
Copy link
Member

gvanrossum commented May 3, 2019 via email

@crusaderky
Copy link
Contributor Author

crusaderky commented May 3, 2019

Tested on Mac.
Another thing I can't figure out - on Linux/Mac, if psutil is missing, get_meminfo() will return {'memory_psutil_missing': ( 'psutil not found, run pip install mypy[dmypy] ' 'to install the needed components for dmypy' )}
On Windows, it will return an empty dict. In setup.py, psutil is only required for dmypy when not running on Windows. It doesn't make much sense to me. Shouldn't psutil be required for dmypy everywhere?

@crusaderky
Copy link
Contributor Author

Ready for merge

@gvanrossum
Copy link
Member

I’m still unsure what the actual problem is you are solving.

@emmatyping
Copy link
Member

@gvanrossum Well for one thing it looks like psutil is not marked as even an optional depency on Windows. So even if I pip install mypy[dmypy] I won't get psutil. Additionally, it seems that we don't give an error message on Windows. Also relaxing the version bounds means people are less likely to have incompatibilities if something else depends on psutil.

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

Successfully merging a pull request may close this issue.

3 participants