-
Notifications
You must be signed in to change notification settings - Fork 309
Cant start tensorflow on M1: mach-o, but wrong architecture #146
Comments
I also encountered this problem
|
Exactly the same problem here. |
I've encountered similar issues. The problem for me was that my venv was running on a different architecture than my base interpreter. Make sure they both don't run on rosetta, u can do that by unchecking "open with rosetta" when you right click and get info on the terminal in the finder. |
HMMM i tried this but it seen not work can you give me a simple video teach? |
Can you pls explain with more details ? I start IDLE.app as is, there is no choice use Rosetta2 or no. The same when I do this in jupyter notebook. |
U can find the same issue with more explanation here |
i follow that post to do same things it still not work.......
by the way numpy is not work too
|
i can use tensorflow on m1 now!!!!!!!! just need to watch this videos is very simple , hope can help others |
@asd3427 do I need to install XCode command tools only or XCode itself as well ? Which version of python do you have ? |
|
If you'd rather install TensorFlow in a Conda Python Environment, you can follow these: #153 |
Also same problem: (tensorflow_macos_venv) lastname@firstname-MacBook-Pro ~ % python
During handling of the above exception, another exception occurred: Traceback (most recent call last): Failed to load the native TensorFlow runtime. |
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 I added the python version that comes with Xcode, That should fix the issue :) |
i encountered the same error while running the venv in tmux. i disabled rosettta for terminal, but |
(Updated on 3 Mar. 2021: Python 3.8.7 -> Python 3.8.8)
|
So what works for me is: Don't use the built-in Python 3.8 to create the virtual environment! Instead, installing Python 3.8 with natively supported Homebrew (so your Python 3.8 path will be something like /opt/homebrew/Cellar/[email protected]/3.8.7/bin/python3.8), and use this Python 3.8 to create the virtual environment, then everything will be fine. Otherwise, I always got the wrong architecture error when importing Tensorflow as long as I created the virtual environment with the built-in Python 3.8 (/usr/bin/python3). Hope this helps! |
i also found the python must be installed from Command line tool! otherwise the python3.8 is not supporting the ARM arch and it would not load tensorflow even if you can install it without error. I hope the it could be emphasized |
I had a similar issue where it was showing that I had 2 architectures and both of them were wrong. First, check the your Python version with |
Hello.
I have followed the manual from this github and started
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
It seems to be virtual environment has been created but when I activate it and start importing tensorflow in my script I get the following:
`>>> import tensorflow as tf
Traceback (most recent call last):
File "/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/init.py", line 41, in
from tensorflow.python.tools import module_util as _module_util
File "/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/init.py", line 39, in
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 83, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/a1/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
Failed to load the native TensorFlow runtime.
`
any hints or advices around this ?
Thank you
The text was updated successfully, but these errors were encountered: