tlkh/asitop

install issue with conda (resolved instruction)

neoswallow opened this issue · 2 comments

I use conda (installed via brew install miniforge) for the python installation and I created a new environment for the asitop along with latest version of python (3.10.2).

After installing asitop via pip install asitop, I got following error message:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/bin/asitop", line 5, in <module>
    from asitop.asitop import main
  File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/asitop/asitop.py", line 6, in <module>
    from .utils import *
  File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/asitop/utils.py", line 5, in <module>
    import psutil
  File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/__init__.py", line 123, in <module>
    from . import _psosx as _psplatform
  File "/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/_psosx.py", line 14, in <module>
    from . import _psutil_osx as cext
ImportError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/_psutil_osx.cpython-310-darwin.so, 0x0002): tried: '/opt/homebrew/Caskroom/miniforge/base/envs/asitop/lib/python3.10/site-packages/psutil/_psutil_osx.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

Removing psutil and reinstalling seems to show that correct arch binary is installed:

pip install psutil                                                                                                                              
Collecting psutil
  Using cached psutil-5.9.1-cp310-cp310-macosx_11_0_arm64.whl
Installing collected packages: psutil
Successfully installed psutil-5.9.1

But I still ended up with same error message.

So I decided to build psutil locally:
pip install --no-binary :all: psutil
(from https://github.com/giampaolo/psutil/blob/master/INSTALL.rst and you need Xcode installed already)

And it finally worked.
Thanks for the awesome package.

I'm creating the issue here in case someone else runs into the same issue.

tlkh commented

Thanks! Interesting I didn't have this issue. Appreciate you sharing it!

It looks like there's an open issue with psutil wheel having wrong architect for the ASi.

giampaolo/psutil#2121
https://stackoverflow.com/questions/72619143/unable-to-import-psutil-on-m1-mac-with-miniforge-mach-o-file-but-is-an-incomp

If and only if I found this SO question earlier~~~ lol

I'm actually surprised no one else ran into this problem as it seems to be the issue with the latest version of psutil, 5.9.1.
Or maybe they found the SO link where I didn't. 😝