ImportError: cannot import name '_psutil_osx' from partially initialized module 'psutil'
See original GitHub issueWhat is the problem?
unable to import Ray or run Ray CLI because of psutil errors
- macOS 11.0.1 (20B29)
- Ray commit 0138c2dbb4857f9c716877a5a5f3cd5cd5a9320a
- Python 3.8.6 [Clang 12.0.0 (clang-1200.0.32.28)]
Reproduction
python3 -m pip install -e .python3 -c "import ray"results in:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../ray/python/ray/__init__.py", line 63, in <module>
import ray._raylet # noqa: E402
File "python/ray/_raylet.pyx", line 98, in init ray._raylet
import ray.memory_monitor as memory_monitor
File ".../ray/python/ray/memory_monitor.py", line 9, in <module>
import psutil # noqa E402
File ".../ray/python/ray/thirdparty_files/psutil/__init__.py", line 159, in <module>
from . import _psosx as _psplatform
File ".../ray/python/ray/thirdparty_files/psutil/_psosx.py", line 15, in <module>
from . import _psutil_osx as cext
ImportError: cannot import name '_psutil_osx' from partially initialized module 'psutil' (most likely due to a circular import) (.../ray/python/ray/thirdparty_files/psutil/__init__.py)
python3 -c "import ray.memory_monitor" results in the same error
python3 -c "import psutil" results in no errors
- I have verified my script runs in a clean environment and reproduces the issue.
- I have verified the issue also occurs with the latest wheels.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
ImportError: cannot import name '_psutil_osx' from partially ...
This is how I solved the problem: I deleted any folders with the name psutil from my site-packages. pip install psutil. I then...
Read more >Why am I receiving the error message "cannot import name ...
Why am I receiving the error message "cannot import name '_psutil_linux' from partially initialized module 'psutil'" when launching jobs within ...
Read more >psutil - PyPI
psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, ...
Read more >psutil documentation — psutil 5.9.5 documentation
When interval is 0.0 or None compares system CPU times elapsed since last call or module import, returning immediately. That means the first...
Read more >cannot import name '_psutil_linux' from partially initialized ...
ImportError : cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due to a circular import) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks!
Definitely. This is what it took for me:
pushd python/ && python3 -m pip install -e . && popdrm -rf python/ray/thirdparty_files/python3 -m pip install setproctitleI’ll leave this open for now; I’ll try to push a doc-fix PR tomorrow.
You can fix it by deleting the
thirdparty_filesdirectory I think