-
Notifications
You must be signed in to change notification settings - Fork 307
zsh: illegal hardware instruction python when Installing TensorFlow for M1 #143
Comments
So, I got it working yesterday after a long time of similar problems.
Then it should work! I hope that helps! Edit: I just forked the repo and added my own instructions on how to properly install it for future reference. Maybe that will help you more: https://github.com/andy-96/tensorflow_macos |
Thank you! My Conda environment was indeed active, will try it later. |
Tbh, I don't know... |
Python3 is shipped with 2 architectures in M1. $ file $(which python3)
/usr/bin/python3: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/python3 (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python3 (for architecture arm64e): Mach-O 64-bit executable arm64e Here, you might need to specify which one to use. You can do this by installing the script like this: arch -arm64 bash install_venv.sh my_tf_env if you have multiple python installations, use: arch -arm64 bash install_venv.sh --python=/usr/bin/python3 my_tf_env You can replace |
@Alyetama is right, I got this issue fixed in my repo, just make sure you have installed Xcode (download the latest version and install it): https://developer.apple.com/download/more/?=command%20line%20tools Then in a terminal paste |
uninstalling tensorflow worked for me |
You can install all the following modules by creating a Virtual Environment, and then installing all these modules inside that Virtual Environment.1. Install Matplotlib1.1 Install Homebrew
1.2 Install libjpeg
1.3 Install Matplotlib In the virtual environment, type:
2. Install tensorflowType in terminal:
3. Install pandasIn your virtual environment, type:
4. Install jupyter notebookIn your virtual environment, type:
Edit the In the _use_appnope() function, edit the return line as follows:
AppendixAbout Installing Different Modules
About Virtual Environment You can create a virtual environment by:
|
I'll give that a shot. There might also be a fix by upgrading to this tensorflow alpha, but I haven't trie dit because it requires that I down grade to 3.8 of python. |
I've followed these steps :
from (https://stackoverflow.com/questions/65383338/zsh-illegal-hardware-instruction-python-when-installing-tensorflow-on-macbook)
I'm using Python 3.8 and I'm running my terminal not rosetta:
(base) user@useros ~ % uname -m
arm64
When I activate my environment I still get:
(venv) (base) user@useros ~ % uname -m
arm64
If I run file $(which python) I get the following:
On base:
(base) user@useros ~ % file $(which python)
/Users/user/opt/anaconda3/bin/python: Mach-O 64-bit executable x86_64
On venv:
(venv) (base) user@useros ~ % file $(which python)
/Users/user/venv/bin/python: Mach-O 64-bit executable x86_64
Why do I get 'Mach-O 64-bit executable x86_64' here even though I get 'arm64' before?
This confuses me and is probably the reason why my code is not working.
The text was updated successfully, but these errors were encountered: