Hi, team I am getting following error when running...
# general
m
Hi, team I am getting following error when running pants goals
Copy code
Bootstrapping Pants using /Users/anoopmishra/miniconda3/bin/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.62/pex> verified.
Installing pantsbuild.pants==2.13.0 into a virtual environment at /Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39
New virtual environment successfully created at /Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39.
Traceback (most recent call last):
  File "/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/bin/pants", line 5, in <module>
    from pants.bin.pants_loader import main
  File "/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 19, in <module>
    from pants.bin.pants_runner import PantsRunner
  File "/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 11, in <module>
    from pants.base.exception_sink import ExceptionSink
  File "/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/pants/base/exception_sink.py", line 16, in <module>
    import psutil
  File "/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/psutil/__init__.py", line 123, in <module>
    from . import _psosx as _psplatform
  File "/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/psutil/_psosx.py", line 14, in <module>
    from . import _psutil_osx as cext
ImportError: dlopen(/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so, 0x0002): tried: '/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_psutil_osx.cpython-39-darwin.so' (no such file), '/usr/lib/_psutil_osx.cpython-39-darwin.so' (no such file), '/Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/pants.iUu4Nv/install/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_psutil_osx.cpython-39-darwin.so' (no such file), '/usr/lib/_psutil_osx.cpython-39-darwin.so' (no such file)
Env: • using miniconda3 python • Apple M1 chip • Mac 12.0.1
h
Hi! Sorry you’re having issues. I don’t know if Pants runs on miniconda, or at least it’s not how it’s usually run… Can you try with a vanilla CPython (e.g., one installed by pyenv)?
Not sure that’s related to this error, but want to rule it out
Oh, also, what does
file /Users/anoopmishra/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so
show?
For context: psutil doesn’t publish macos arm64 wheels, so when the venv is created during setup, the sdist will be downloaded and built.
Looks like that is being built as an x86_64 binary, even on your arm64 system, which can happen if something is running under rosetta
So my guess is that your miniconda3 interpreter is an x86_64 binary, running under rosetta?
Which you can check with
file path/to/bin/python
b
surprisingly, when I ran
file
on the
cpython-39-darwin.so
file it's x86_64 but i never see this issue on my m1 under arm64 mode