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

[Linux] cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due to a circular import) #2419

Closed
mattthhh opened this issue May 21, 2024 · 3 comments

Comments

@mattthhh
Copy link

Summary

  • OS: RedHat8
  • Architecture: 64bit
  • Psutil version: 5.9.8 (cloned today)
  • Python version: python3.11
  • Type: import locally

Description

Hi, when I try to import the the lib that I cloned to modules/libs/ with these lines :

sys.path.insert(0, "modules/libs/")
import psutil

I got this error :
ImportError: cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due to a circular import)

Any ideas ? (I don't want to use pip or venv to get the library, because it needs to be flexible)

@mattthhh mattthhh added the bug label May 21, 2024
@github-actions github-actions bot added the linux label May 21, 2024
@giampaolo
Copy link
Owner

giampaolo commented May 21, 2024

psutil is not a pure python module, it needs to be compiled, so you can't get away with sys.path.insert.

@mattthhh
Copy link
Author

mattthhh commented May 21, 2024

Okay, do you have any ideas to import this lib without pip and venv ? Maybe compile it from the source code ?

@mattthhh
Copy link
Author

Okay I found, just compile it locally with a simple python interpreter, and add the result of the compilation in sys.path

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

2 participants