giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.31k stars 1.39k forks source link

[OS] ImportError: cannot import name '_psutil_linux' on ppc64 RHEL8 LE #1689

Open srikanthjoshi opened 4 years ago

srikanthjoshi commented 4 years ago

Platform

Bug description I am trying to configure airflow on IBM POWER platform which is with ppc64 architecture. It is failing with error - "ImportError: cannot import name '_psutil_linux'"

I just tried to import psutil in python, even that is also giving same error :

(srikanth) [root@brazossrik01 psutil]# python Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:34:02) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import psutil Traceback (most recent call last): File "", line 1, in File "/root/anaconda3/envs/srikanth/lib/python3.6/site-packages/psutil/init.py", line 96, in from . import _pslinux as _psplatform File "/root/anaconda3/envs/srikanth/lib/python3.6/site-packages/psutil/_pslinux.py", line 26, in from . import _psutil_linux as cext ImportError: cannot import name '_psutil_linux'

I am assuming the problem seems to be It looks like we don't have psutil built for ppc64 architecture.

If not, please let me know what is the issue.

Test results { output of python -c psutil.tests (failures only, not full result) }

JavaScriptDude commented 4 years ago

Same here on Ubuntu 18.04:

% python3
Python 3.7.3 (default, May 19 2019, 22:17:35) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/psutil/__init__.py", line 100, in <module>
    from . import _pslinux as _psplatform
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 26, in <module>
    from . import _psutil_linux as cext
ImportError: cannot import name '_psutil_linux' from 'psutil' (/usr/lib/python3/dist-packages/psutil/__init__.py)
>>> 

I tried the purge script from another issue and re-installing and it had no effect. Same problem.

JavaScriptDude commented 4 years ago

Note: I was able to resolve by re-installing my python3.7 files using a PPA and then installing psutil in user mode (python3.7 -m pip install --user psutil). Once I did this, it worked fine. However, I still have not figured out how to get it working from a cron job. Seems like a different issue as it just cannot find the package and others I tested.