How To ((NEW)) Download Psutil In Python

0 views
Skip to first unread message

Krissy Pfundt

unread,
Jan 21, 2024, 11:02:09 AM1/21/24
to mayskylapin

I wrote a package with a dependency's dependency to psutil (my-package depends on third-party-package which depends on psutil).
Since it's supposed to run on a server without any connectivity and without gcc, I prepared the deployment locally with a psutil python platform wheel and pip install my-package --download, then sent everything on the server.

how to download psutil in python


Download Ziphttps://t.co/F9yAym6e6A



Now everything is ready on the server, but for some reason, when I run the installation, pip refuses to install psutil. Note that the server is a red hat 7.2 running pip 7.1.0, virtualenv 1.10.1 and python 2.7.5 (and I can't change the version of anything).

I don't know if this is the same problem (I am working on a vanilla Ubuntu 16.04), but I was getting a similar frustrating message around psutil. The problem seemed to be that it was installed in my Python 2.7 version, and pip was only looking at that version, seemingly ignoring the fact that my current virtual environment was Python 3.5.

I noticed pip3 did nothing, so I installed pip3 with apt-get install python3-pip. Then I could could successfully use pip3 install psutil to install into the correct Python3.5 and my virtual directory.

What I am puzzled by is how I got so far without hitting this earlier. I have installed lots of things over the last few months with pip and they seemingly went into both versions (side-by-side Python2.7 and Python3.5 environments for running TensorFlow). Why is it different for psutil?

Listing unmounted block devices is OS-dependent: The mechanism for doing so is not common between MacOS and Linux, and presently, the psutil library does not implement an abstraction layer over those differentes.

So after that I did folowing:
1. install MinGW (refer to page- )
2. install pycrypto2.6.1 (I've found it here - -pycrypto-windows-installer)
for others python version please refer this page -- www.voidspace.org.uk/python/modules.shtml#pycrypto
3. check

Based on the other posts, I tried to lower the python image version/ pip but still I am getting the same error. I observed that I'm only getting this error while installing certain packages from requirements.txt like DataProfiler

In Python, why am I seeing psutil.AccessDenied errors/exceptions when iterating through my processes (which works just fine) and printing their command lines via psutil.cmdline() (which, frustratingly experiences the aforementioned Exception for the exact same process, where psutil.name() works fine), as per the following code snippet?

Apparently Python (or at least my python v3.11.2, macOS v12.6.3 system) lets you iterate through all the OS/system's processes, but prevents you from reading the cmdline of all the processes, even if it lets you read the "base name" of the process of cmdline-problematic processes. More details.

Can someone help me understand why I can't install psutil? I'm on MacOS. I'm a noob so bear with me, but any help would be appreciated. Could it be something to do with the default Python install vs v3 that I installed? I'm new to command line so confused about what is causing the error and how to fix it...

My immediate thought is anything that would help with the multi-process instance(s) discussed above - a bit like a psutils+ or something, perhaps using MySQL to store 'global' process info for a user. But I don't have a feel yet for the most common issues affecting other folk.

df19127ead
Reply all
Reply to author
Forward
0 new messages