Reputation: 209
Followed this guide (Cannot pip install mediapipe on Macos M1) to install Mediapipe on M1 mac, and now I am unable to use pandas or numpy.
ImportError: dlopen(/Users/matthewcuevas/Library/Python/3.8/lib/python/site-packages/pandas/_libs/interval.cpython-38-darwin.so, 0x0002): tried: '/Users/matthewcuevas/Library/Python/3.8/lib/python/site-packages/pandas/_libs/interval.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
Upvotes: 20
Views: 73544
Reputation: 14338
mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')
abrew install <youLibName>
abrew install capstone
x86_64
) lib before install new arch(arm64)
ibrew uninstall <youLibName>
abrew
and ibrew
is alias
> cat ~/.zshrc| grep brew
alias abrew="arch -arm64 /opt/homebrew/bin/brew"
alias ibrew="arch -x86_64 /usr/local/bin/brew"
arch -arm64
arch -arm64 python -m pip install <youLibName>
arch -arm64 python3.11 -m pip install capstone
Upvotes: -1
Reputation: 128
Manually install Package Control work for me:
Download "Package.Control.sublime-package" from https://github.com/wbond/package_control [Rename to "Package Control.sublime-package"]
Put this plugin under directory
your_application/Sublime Text/Installed Packages
Upvotes: 0
Reputation: 1
conda install pyworld fixed it for me.
conda install conda-forge::pyworld
Upvotes: 0
Reputation: 15247
As someone who stumbled across this a year later looking for help, let me tell you how broken the Python ecosystem is on macOS, all because no one has bothered to implement platform auto-detection.
The canonical way I found is to first install the ARM64 version of Miniconda. You can use that to create your Python environments.
That's not enough though; once you have it installed, you need to explicitly tell it to use the arm64 subdirectory for all packages. Because nothing in Python is smart enough to detect your platform. So to do that:
conda config --env --set subdir osx-arm64
Now any packages you install will use the native version. Godspeed.
Upvotes: 2
Reputation: 893
pandas
and numpy
seem to have been installed using the wrong architecture. You can fix that by uninstalling current versions and installing them with the architecture your machine runs on (M1, or arm64, in this case).
python -m pip uninstall pandas numpy
Now, install their arm64 equivalents. To make sure you're not using the cashed versions (x86_64) that were used before, you can add the --no-cache
flag to download the arm64 versions.
arch -arm64 python -m pip install numpy pandas --no-cache
Upvotes: 13
Reputation: 358
I solved by installing with conda instead of pip.
So, instead of
pip install pydantic==yourversion
Use:
conda install pydantic==yourversion
.
Or, you can try installing with --no-binary
(it saved me in a similar issue):
pip install pydantic==version --no-binary :all:
Upvotes: 0
Reputation: 381
I got an error like this too. Solved it after a lot of trial & error.
The Problem: my brew was still running on Rosetta. Fixed that by uninstalling, cleaning and reinstalling. So everything seemed to run fine. Except this problem still kept cropping up
Until I discovered that pip is quite agressive in caching. So it caches the build even if the architecture changed. Solution: pip cache purge. Or remove the whole cache directory which you find with pip cache info
Upvotes: 11
Reputation: 665
This will not be answer to your question/specific situation (most probably), but I got this issue when using python built for pyenv/virtualenv, and rm -rf ~/.pyenv
helped me. So, python was reinstalled (properly this time; reinstalled by other scripts in our CI, because I deleted installation), and it's built for x86 and works fine on arm.
Upvotes: 1
Reputation: 2327
Go to Applications -> Xcode, then right click and select get info.
Then enable checbox "Open using Rosetta"
Finally close Xcode and open it and try again.
Upvotes: -2