question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

psutil is never installed on Windows

See original GitHub issue

On Windows, it turns out pyperf (and hence pyperformance) will always print a warning when psutil is not installed. The warning is:

WARNING: unable to increase process priority

It is printed by _process_priority(). (Note the if not MS_WINDOWS: return right before.)

The function set_priority() silently returns None, but the caller prints the warning in that case.

So now for every benchmark run by pyperformance it calls this _process_priority() function for each run, printing the warning each time (maybe 10 times per run).

The solution of course is to install psutil. But no matter what I do, because the way venvs used to run the benchmark are created, those venvs do not get psutil installed, even if it is installed in site-packages. (At least, when running from a dev environment.)

  • I tried adding "psutil" to the install_requires line in pyperformance’s setup.py, but that doesn’t seem to help.
  • psutil is already listed in requirements.in, so that doesn’t seem to make a difference.
  • It is also listed in pyperformance/data-files/requirements.txt, apparently with no effect.

So how do I add this dependency to every package? Surely there’s a more elegant way than adding it to every benchmark-specific requirements.txt file in pyperformance/data-files/benchmarks?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
gvanrossumcommented, Mar 28, 2022

Still no dice. 😦

Now it does indeed try to install psutil, but since there’s no wheel, it tries to build from source, and fails in the same way I’ve described elsewhere. And since apparently in this case there’s no way to get a psutil wheel to end up in pip’s wheel cache I still cannot get this working.

UPDATE: There is a way to get a psutil wheel in the pip cache (same as before), and then it does work. Not sure what I did wrong the first time I tried.

0reactions
vstinnercommented, Mar 30, 2022

It would be nice to put that command in pyperformance compile, since it’s non-trivial and it’s always pleasant when things are automated. Running a benchmark is hard enough 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failure to install psutil on windows - Stack Overflow
I installed the visual studio requirement as shown through console www.microsoft.com/download/details.aspx?id=8279 however I still get the error ...
Read more >
[Fixed] ModuleNotFoundError: No module named 'psutil'
Make sure pip is installed on your machine. To fix this error, you can run the following command in your Windows shell:.
Read more >
ModuleNotFoundError: No module named 'psutil' in Python
The Python "ModuleNotFoundError: No module named 'psutil'" occurs when we forget to install the psutil module before importing it or install it in...
Read more >
How to install python module psutil manually from ... - YouTube
In this video we are going to see how to install psutil module manually from whl (wheel) package using pip installer on Windows...
Read more >
psutil 0.7.0 - PyPI
pip install psutil==0.7.0 ... It currently supports Linux, Windows, OSX and FreeBSD both 32-bit and 64-bit with Python versions from 2.4 to 3.3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found