Closed soimkim closed 2 years ago
It looks like you're running a native (ARM) python, but python-magic is finding an Intel copy of the libmagic shared library.
Do you know how /usr/local/Cellar/libmagic/5.41/lib/libmagic.dylib got installed? It looks like homebrew now supports M1 officially (just as of a few weeks ago), so could you try get M1-native homebrew packages installed?
Alternatively, you could run python from your current Intel homebrew install instead of (presumably) the OS install, and it would use the runtime translation and presumably work at the cost of a speed hit.
/usr/local/Cellar/libmagic/5.41/lib/libmagic.dylib was installed with brew install libmagic. Even after re-installing with brew reinstall, the result is the same. 😢
I'll check again if m1-native homebrew is installed. Thanks for the reply. 🙂
Here has a strange solution:
pip3 install python-magic-bin
pip3 uninstall python-magic
But I don't know why it works...
@wshs0713 not sure why that would work...
@soimkim are you using homebrew 3.0? That's the one with M1 support, and it defaults to /opt/homebrew according to this page: https://mac.install.guide/homebrew/index.html
When I installed libmagic I installed it wrong. Reinstalled brew and re-installed libmagic and it works fine. 😄 (python-magic-bin did not work in m1, so I installed it as python-magic.)
Thanks for answering my question.👍
After running
brew install libmagic
pip install python-magic
I had the issue that my python platform was for x86_64, but brew installed the arm64 binaries of libmagic. This resulted in a hidden error about a platform mismatch (#279).
Check python-platform:
import platform
platform.machine()
I then uninstalled the recently installed arm64-libmagic-binaries and installed another homebrew with x86_64 architecture (this is likely overkill):
# How to install it with x86 libomp:
# install x86_64 variant of brew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# install x86_64 variant of libmagic
arch -x86_64 /usr/local/bin/brew install libmagic
The alternative would have been to set up the conda environment as arm64 (probably easier): https://stackoverflow.com/questions/65415996/how-to-specify-the-architecture-or-platform-for-a-new-conda-environment-apple
When Python-magic is installed and executed on Apple Silicon(m1), the following bug occurs. Is there any workaround?