Open monikavila opened 3 years ago
I got the same issue. Not quite sure if we need to reinstall a lower version instead?
I encountered the same problem when I installed it. How did you install TensorFlow? I finally downloaded https://github.com/apple/tensorflow_macos/releases and manually executed download_and_install. This method works for me.
I encountered the same problem when I installed it. How did you install TensorFlow? I finally downloaded https://github.com/apple/tensorflow_macos/releases and manually executed download_and_install. This method works for me.
This didn't work for me :/
Did you guys use anaconda?
I got the same issue.and I have tried the similar issue for X86 but it doesn't work
Same issue for me on Mac Mini M1 With Big Sur Beta. @pekoWang what did you exactly with the downloaded archive along with the download_and_install-script?
Same issue with me. Tried MANY different methods. Also tried older versions of tensorflow, but that also didn't work because it was the "wrong type of architecture" (referring to the new processor).
Same issue with me. Tried MANY different methods. Also tried older versions of tensorflow, but that also didn't work because it was the "wrong type of architecture" (referring to the new processor).
Yes, it is weird since Apple announced that tensor flow was optimised in MacBook Pro M1 "The Mac has long been a popular platform for developers, engineers, and researchers. With Apple’s announcement last week, featuring an updated lineup of Macs that contain the new M1 chip, Apple’s Mac-optimized version of TensorFlow 2.4 leverages the full power of the Mac with a huge jump in performance."
https://blog.tensorflow.org/2020/11/accelerating-tensorflow-performance-on-mac.html
We should contact Macbook Pro for a solution.
hello guys I think I have found the solution. first, uninstall anaconda and any python3 that you didn't download from apple. then please xcode-select --install(maybe you can download Xcode from app store) after that, you will get python3.8.2 from apple , please check if your python is 3.8.2 and it's path is/usr/bin/python3. if succeed, run the install_venv.sh again. ps:in the last step, you should build a new venv,or just delete the old venv on anaconda/python3 not downloaded from apple and it works finally.
hello guys I think I have found the solution. first, uninstall anaconda and any python3 that you didn't download from apple. then please xcode-select --install(maybe you can download Xcode from app store) after that, you will get python3.8.2 from apple , please check if your python is 3.8.2 and it's path is/usr/bin/python3. if succeed, run the install_venv.sh again. ps:in the last step, you should build a new venv,or just delete the old venv on anaconda/python3 not downloaded from apple and it works finally.
It's work for me
So I installed Xcode and now don’t have any new python installed (only version 2.7.16, which is the version that comes with Big Sur.
Any tips for getting puython from Xcode?
On 6 Dec 2020, at 11:34, roy notifications@github.com wrote:
hello guys I think I have found the solution. first, uninstall anaconda and any python3 that you didn't download from apple. then please xcode-select --install(maybe you can download Xcode from app store) after that, you will get python3.8.2 from apple , please check if your python is 3.8.2 and it's path is/usr/bin/python3. if succeed, run the install_venv.sh again. ps:in the last step, you should build a new venv,or just delete the old venv on anaconda/python3 not downloaded from apple and it works finally.
It's work for me
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/apple/tensorflow_macos/issues/48#issuecomment-739489924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC64ESXCE7CYR3BUCTKUJATSTNT5BANCNFSM4UMRG5MA.
So I installed Xcode and now don’t have any new python installed (only version 2.7.16, which is the version that comes with Big Sur. Any tips for getting puython from Xcode? … On 6 Dec 2020, at 11:34, roy @.***> wrote: hello guys I think I have found the solution. first, uninstall anaconda and any python3 that you didn't download from apple. then please xcode-select --install(maybe you can download Xcode from app store) after that, you will get python3.8.2 from apple , please check if your python is 3.8.2 and it's path is/usr/bin/python3. if succeed, run the install_venv.sh again. ps:in the last step, you should build a new venv,or just delete the old venv on anaconda/python3 not downloaded from apple and it works finally. It's work for me — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#48 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC64ESXCE7CYR3BUCTKUJATSTNT5BANCNFSM4UMRG5MA.
I download Xcode app and run ''xcode-select --install''at the same time so I can't find out where the python3.8.2 came from.how about trying downloading the Xcode command line tools for Xcode12.2 (you can find it in readme)and then bash '' xcode-select --install'' in the terminal?
I got Tensor Flow working on my Anaconda Spyder.
As I was a noob to these, so let me share my detailed findings for other people in similar boat.
First I downloaded: https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha0/tensorflow_macos-0.1alpha0.tar.gz
After unzipping, there is 2 folders inside arm64 and x86_64. The first reaction is for people to install arm64, since we have the Mac M1 chip. But actually since we wanted to install into Anaconda which runs through Rosetta2 as an Intel, we should install x86_64, which will run slower, but at least you have all the libraries such as pandas and support apps.
To Install x86_64 into Anaconda (so I can run in Spyder): 1) Anaconda start a new environment 2) Uninstall tensorflow & tensorboard if exists 3) Rename all the files inside the x86_64 folder from 11_0 to 10_16. Example: tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl 4) In Conda console run below with 'username' replaced with your username: pip install pip wheel setuptools cached-property six pip install "/Users/username/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_10_16_x86_64.whl" pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl"
Source: https://github.com/apple/tensorflow_macos/issues/7#issuecomment-730266180
To Install arm64 into virtualenv This would give the fastest speed since it uses the native arm64, but it doesn't support many libraries at the moment, including pandas.
To install: 1) With tensorflow_macos unzipped in the Downloads folder 2) In Terminal: browse to Downloads folder 3) Run: /bin/bash ./tensorflow_macos/install_venv.sh --prompt 4) Key in your desired path or just Enter for the default path
To Run: 1) In a new terminal run: source /Users/username/tensorflow_macos_venv/bin/activate 2) python3 "your_python_file.py"
To toggle between CPU and GPU runs adjust the device_name below: from tensorflow.python.compiler.mlcompute import mlcompute mlcompute.set_mlc_device(device_name='gpu')
To make it faster, turn off the default Eager mode with the following line: tf.compat.v1.disable_eager_execution()
Run Speed Comparison for MNIST character recognition: Anaconda Spyder (x86_64, EagerOff): 200-256us/sample Terminal (arm64, CPU, EagerOff): 22-63us/sample Terminal (arm64, GPU, EagerOff): 137-166us/sample
So I installed Xcode and now don’t have any new python installed (only version 2.7.16, which is the version that comes with Big Sur. Any tips for getting puython from Xcode? … On 6 Dec 2020, at 11:34, roy @.***> wrote: hello guys I think I have found the solution. first, uninstall anaconda and any python3 that you didn't download from apple. then please xcode-select --install(maybe you can download Xcode from app store) after that, you will get python3.8.2 from apple , please check if your python is 3.8.2 and it's path is/usr/bin/python3. if succeed, run the install_venv.sh again. ps:in the last step, you should build a new venv,or just delete the old venv on anaconda/python3 not downloaded from apple and it works finally. It's work for me — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#48 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC64ESXCE7CYR3BUCTKUJATSTNT5BANCNFSM4UMRG5MA.
I download Xcode app and run ''xcode-select --install''at the same time so I can't find out where the python3.8.2 came from.how about trying downloading the Xcode command line tools for Xcode12.2 (you can find it in readme)and then bash '' xcode-select --install'' in the terminal?
@godkaieethu Thanks a lot! I will try it :)
I solved the "ERROR: numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform" by uninstalling the python 3.8 first and then re-installing it through the Xcode Command Line Tools. After that I ran the install script again and had no issues. If you install python directly it will not work and you will get the above error.
BTW I tested TF on M1 Mac Mini against TF on RTX 2080Ti and it ran 14% faster. I was so amazed that I posted it on Medium
@tampapath what is the Xcode Command Line code for the install?
Hi simonaque, Go back to https://github.com/apple/tensorflow_macos site. Under the REQUIREMENTS: "Python 3.8, available from the Xcode Command Line Tools" click on the Command Line Tools link. That will get you to apples developers site. Sign in with your password and you will be presented with download links. Choose the one corresponding to the version of XCode that you have. Python 3.8 is included in the download. I hope this helps.
For anyone tuning in later, the latest Tensorflow install script seems to have a typo with some case mismatches in the variable names. I proposed a Pull Request to fix that & add Conda support (so you can install TF in your Miniforge Conda environment). I also provided instructions for how I installed both an ARM supported version of Miniforge/Conda Python and Tensorflow on it.
Feel free to manually apply my changes and see how it goes for you: https://github.com/apple/tensorflow_macos/pull/63
@monikavila, as @tampapath suggested, you'll want to use python from Xcode. Once you install it, it should be at /Library/Developer/CommandLineTools/usr/bin/python3
.
See here.
/bin/bash tensorflow_macos/install_venv.sh -p --python=/Library/Developer/CommandLineTools/usr/bin/python3
.. ~/tensorflow_macos/bin/activate
if your environment is at ~/tensorflow_macos
.) I have trouble with Conda and TF for M1, so I'm going to wait for Apple to fix it. (Your Conda setup is in ~/.bash_profile
. You may want to turn it off. Price to pay as early adopters.)file $(which python)
should return something like Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
. You do not want Mach-O 64-bit executable x86_64
.none of the above worked for me. I tried uninstalling the versions of python on my system (not the native ones), uninstalling x-code command line tools and reinstalling, but I continued to get a different error ("illegal hardware instruction")
however, I temporarily downgraded to tensorflow 1.5.0 (and used matching versions of keras, etc.) and the errors went away. if anyone figures out how to get rid of the illegal hardware instruction error, please reply!
None of the above worked for me. The kernel continues to break down when I try to import Tensorflow.
None of the above worked for me. The kernel continues to break down when I try to import Tensorflow.
Same here, I managed to install it into anaconda venv, but kernel keeps breaking down when I try to import Tensorflow.
You're using the word 'anaconda' -- remember that anaconda is not ARM compatible. You need to use the ARM version of miniforge (or some other ARMed version of Python). I personally used the ARM version of miniforge
I've used conda mini-forge to install many packages for data work, to include numpy, pandas, matplotlib, jupyterlab3, seaborn, sqlalchemy, geopy, elementpath, google-cloud-bigquery, scikit-learn. This works so far but also brings python 3.9 along in my home directories. There's no need to uninstall anything. To create a venv I hunted down the version of python that installed from apple, 3.8.2. The tensorflow package won't install in a 3.9 venv.
Version 3.8 should be installed in /Library/Developer/CommandLineTools/usr/bin/python3
Create a virtual environment with 3.8: /Library/Developer/CommandLineTools/usr/bin/python3 -m venv path_to_new_venv
Use this new environment when calling the install_venv.sh path_to_new_venv.
I now have two virtual environments for data work on the M1 Macbook, but I think it's feasible to save data from one to use in the other. This is an alpha version, so I think it's worth a little trouble to use the new Macbook, which is a fast and portable platform.
I've used conda mini-forge to install many packages for data work, to include numpy, pandas, matplotlib, jupyterlab3, seaborn, sqlalchemy, geopy, elementpath, google-cloud-bigquery, scikit-learn. This works so far but also brings python 3.9 along in my home directories. There's no need to uninstall anything. To create a venv I hunted down the version of python that installed from apple, 3.8.2. The tensorflow package won't install in a 3.9 venv.
Version 3.8 should be installed in /Library/Developer/CommandLineTools/usr/bin/python3
Create a virtual environment with 3.8: /Library/Developer/CommandLineTools/usr/bin/python3 -m venv path_to_new_venv
Use this new environment when calling the install_venv.sh path_to_new_venv.
I now have two virtual environments for data work on the M1 Macbook, but I think it's feasible to save data from one to use in the other. This is an alpha version, so I think it's worth a little trouble to use the new Macbook, which is a fast and portable platform.
sadly, this still does not work for me. here are the exact steps I followed:
/Library/Developer/CommandLineTools/usr/bin/python3 -m venv new_env
tensorflow_macos-0.1alpha1.tar.gz
/bin/bash ./tensorflow_macos/install_venv.sh
and specify the path to the new environmentimport tensorflow
this crashes, and gives me 82113 illegal hardware instruction
my terminal was running with Rosetta :( I opened my terminal without rosetta, did the same exact steps outlined above, and everything worked.
woo!
I got Tensor Flow working on my Anaconda Spyder.
As I was a noob to these, so let me share my detailed findings for other people in similar boat.
First I downloaded: https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha0/tensorflow_macos-0.1alpha0.tar.gz
After unzipping, there is 2 folders inside arm64 and x86_64. The first reaction is for people to install arm64, since we have the Mac M1 chip. But actually since we wanted to install into Anaconda which runs through Rosetta2 as an Intel, we should install x86_64, which will run slower, but at least you have all the libraries such as pandas and support apps.
To Install x86_64 into Anaconda (so I can run in Spyder):
- Anaconda start a new environment
- Uninstall tensorflow & tensorboard if exists
- Rename all the files inside the x86_64 folder from _110 to _1016. Example: tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl
- In Conda console run below with 'username' replaced with your username: pip install pip wheel setuptools cached-property six pip install "/Users/username/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_10_16_x86_64.whl" pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl"
Source: #7 (comment)
To Install arm64 into virtualenv This would give the fastest speed since it uses the native arm64, but it doesn't support many libraries at the moment, including pandas.
To install:
- With tensorflow_macos unzipped in the Downloads folder
- In Terminal: browse to Downloads folder
- Run: /bin/bash ./tensorflow_macos/install_venv.sh --prompt
- Key in your desired path or just Enter for the default path
To Run:
- In a new terminal run: source /Users/username/tensorflow_macos_venv/bin/activate
- python3 "your_python_file.py"
To toggle between CPU and GPU runs adjust the device_name below: from tensorflow.python.compiler.mlcompute import mlcompute mlcompute.set_mlc_device(device_name='gpu')
To make it faster, turn off the default Eager mode with the following line: tf.compat.v1.disable_eager_execution()
Run Speed Comparison for MNIST character recognition: Anaconda Spyder (x86_64, EagerOff): 200-256us/sample Terminal (arm64, CPU, EagerOff): 22-63us/sample Terminal (arm64, GPU, EagerOff): 137-166us/sample
Worked perfectly, thanks!
same,i see some guy worked,they used miniconda,but i anaconda.is this?
@tomuGo Anaconda is not the same thing as Miniforge, Anaconda has not been compiled for ARM yet. Consider following the steps and making the changes proposed in !63 if you want a Conda Python install, or following the instructions in this issue to follow the officially supported Apple method.
I got Tensor Flow working on my Anaconda Spyder. As I was a noob to these, so let me share my detailed findings for other people in similar boat. First I downloaded: https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha0/tensorflow_macos-0.1alpha0.tar.gz After unzipping, there is 2 folders inside arm64 and x86_64. The first reaction is for people to install arm64, since we have the Mac M1 chip. But actually since we wanted to install into Anaconda which runs through Rosetta2 as an Intel, we should install x86_64, which will run slower, but at least you have all the libraries such as pandas and support apps. To Install x86_64 into Anaconda (so I can run in Spyder):
- Anaconda start a new environment
- Uninstall tensorflow & tensorboard if exists
- Rename all the files inside the x86_64 folder from _110 to _1016. Example: tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl
- In Conda console run below with 'username' replaced with your username: pip install pip wheel setuptools cached-property six pip install "/Users/username/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_10_16_x86_64.whl" pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl"
Source: #7 (comment) To Install arm64 into virtualenv This would give the fastest speed since it uses the native arm64, but it doesn't support many libraries at the moment, including pandas. To install:
- With tensorflow_macos unzipped in the Downloads folder
- In Terminal: browse to Downloads folder
- Run: /bin/bash ./tensorflow_macos/install_venv.sh --prompt
- Key in your desired path or just Enter for the default path
To Run:
- In a new terminal run: source /Users/username/tensorflow_macos_venv/bin/activate
- python3 "your_python_file.py"
To toggle between CPU and GPU runs adjust the device_name below: from tensorflow.python.compiler.mlcompute import mlcompute mlcompute.set_mlc_device(device_name='gpu') To make it faster, turn off the default Eager mode with the following line: tf.compat.v1.disable_eager_execution() Run Speed Comparison for MNIST character recognition: Anaconda Spyder (x86_64, EagerOff): 200-256us/sample Terminal (arm64, CPU, EagerOff): 22-63us/sample Terminal (arm64, GPU, EagerOff): 137-166us/sample
Worked perfectly, thanks!
Thank you! This worked for me. There was one extra step for me to make Jupyter Notebooks work:
Now I'm able to run Tensorflow on Jupyter Notebooks!
EDIT: You have to open the kernel you just copied and change the "display name" field and, in Jupyter, change the kernel to this new one.
I codified the process here https://github.com/oresttokovenko/ARM64-Mac-Deep-Learning-Set-Up
let me know if there are any mistakes or anything else I should add.
I got Tensor Flow working on my Anaconda Spyder.
As I was a noob to these, so let me share my detailed findings for other people in similar boat.
First I downloaded: https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha0/tensorflow_macos-0.1alpha0.tar.gz
After unzipping, there is 2 folders inside arm64 and x86_64. The first reaction is for people to install arm64, since we have the Mac M1 chip. But actually since we wanted to install into Anaconda which runs through Rosetta2 as an Intel, we should install x86_64, which will run slower, but at least you have all the libraries such as pandas and support apps.
To Install x86_64 into Anaconda (so I can run in Spyder):
- Anaconda start a new environment
- Uninstall tensorflow & tensorboard if exists
- Rename all the files inside the x86_64 folder from _110 to _1016. Example: tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl
- In Conda console run below with 'username' replaced with your username: pip install pip wheel setuptools cached-property six pip install "/Users/username/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_10_16_x86_64.whl" pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl"
Source: #7 (comment)
To Install arm64 into virtualenv This would give the fastest speed since it uses the native arm64, but it doesn't support many libraries at the moment, including pandas.
To install:
- With tensorflow_macos unzipped in the Downloads folder
- In Terminal: browse to Downloads folder
- Run: /bin/bash ./tensorflow_macos/install_venv.sh --prompt
- Key in your desired path or just Enter for the default path
To Run:
- In a new terminal run: source /Users/username/tensorflow_macos_venv/bin/activate
- python3 "your_python_file.py"
To toggle between CPU and GPU runs adjust the device_name below: from tensorflow.python.compiler.mlcompute import mlcompute mlcompute.set_mlc_device(device_name='gpu')
To make it faster, turn off the default Eager mode with the following line: tf.compat.v1.disable_eager_execution()
Run Speed Comparison for MNIST character recognition: Anaconda Spyder (x86_64, EagerOff): 200-256us/sample Terminal (arm64, CPU, EagerOff): 22-63us/sample Terminal (arm64, GPU, EagerOff): 137-166us/sample
I did the x86_64 installation and my attempt was to use a conda environment, which includes tf for M1 in PyCharm CE, but when start a new project, set the interpreter to the conda env and create it, no interpreter is loaded and adding it afterwards is also not possible for me as the same happens, it does not load. And when using jupyter the kernel dies almost instantly...
@redmlr You could use Miniforge which is Anaconda without any of the packages built in, but has conda, & has ARM libraries such as Pandas.
I got Tensor Flow working on my Anaconda Spyder. As I was a noob to these, so let me share my detailed findings for other people in similar boat. First I downloaded: https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha0/tensorflow_macos-0.1alpha0.tar.gz After unzipping, there is 2 folders inside arm64 and x86_64. The first reaction is for people to install arm64, since we have the Mac M1 chip. But actually since we wanted to install into Anaconda which runs through Rosetta2 as an Intel, we should install x86_64, which will run slower, but at least you have all the libraries such as pandas and support apps. To Install x86_64 into Anaconda (so I can run in Spyder):
- Anaconda start a new environment
- Uninstall tensorflow & tensorboard if exists
- Rename all the files inside the x86_64 folder from _110 to _1016. Example: tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl
- In Conda console run below with 'username' replaced with your username: pip install pip wheel setuptools cached-property six pip install "/Users/username/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_10_16_x86_64.whl" pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_10_16_x86_64.whl" pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard pip install "/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl"
Source: #7 (comment) To Install arm64 into virtualenv This would give the fastest speed since it uses the native arm64, but it doesn't support many libraries at the moment, including pandas. To install:
- With tensorflow_macos unzipped in the Downloads folder
- In Terminal: browse to Downloads folder
- Run: /bin/bash ./tensorflow_macos/install_venv.sh --prompt
- Key in your desired path or just Enter for the default path
To Run:
- In a new terminal run: source /Users/username/tensorflow_macos_venv/bin/activate
- python3 "your_python_file.py"
To toggle between CPU and GPU runs adjust the device_name below: from tensorflow.python.compiler.mlcompute import mlcompute mlcompute.set_mlc_device(device_name='gpu') To make it faster, turn off the default Eager mode with the following line: tf.compat.v1.disable_eager_execution() Run Speed Comparison for MNIST character recognition: Anaconda Spyder (x86_64, EagerOff): 200-256us/sample Terminal (arm64, CPU, EagerOff): 22-63us/sample Terminal (arm64, GPU, EagerOff): 137-166us/sample
I did the x86_64 installation and my attempt was to use a conda environment, which includes tf for M1 in PyCharm CE, but when start a new project, set the interpreter to the conda env and create it, no interpreter is loaded and adding it afterwards is also not possible for me as the same happens, it does not load. And when using jupyter the kernel dies almost instantly...
Hey. So I had the same problem for like 3 months and this worked (using Jupyter Notebook launched from within Anaconda):
After you followed all steps described by Gupta, try this:
1) Copy the kernel that you just created in Anaconda from:
~/opt/anaconda3/envs/'yourEnvironmentName'/share/jupyter/kernels/python3/kernel.json to ~/Library/Jupyter/kernels
2) Open the kernel you just copied in a text editor and change the "display name" field to something unique (otherwise it will show as "python 3" in anaconda. I used "python 3 TF")
3) Launch Jupyter.
4) In the kernel menu, change the kernel to the kernel you just added (e.g.: python 3 TF).
I hope this helps! Apple: it just works (ha!)
thank you @icenando, but I don't have a directory "~/Library/Jupyter/kernels"
@redmlr You could use Miniforge which is Anaconda without any of the packages built in, but has conda, & has ARM libraries such as Pandas.
63
thanks @mwidjaja1, could you tell me how I use miniforge? what is the terminal prefix for creating new environments?
thank you @icenando, but I don't have a directory "~/Library/Jupyter/kernels"
It's hidden in your home folder. Press SHIFT + CMD + . to show all hidden folders. It should be there. For example, mine is in /Users/"myUserName"/Library/Jupyter/kernels/python3_TF
oh, didn't thought of that at all.. Okay, I got the Library and the Jupyter folder inside, but no "kernels" folder, just "runtime, nbconvert, nbsignatures.db, notebook_seret"
oh, didn't thought of that at all.. Okay, I got the Library and the Jupyter folder inside, but no "kernels" folder, just "runtime, nbconvert, nbsignatures.db, notebook_seret"
That's interesting. I think that if you just create a "kernels" folder and put the "python3/kernel.json" that you copied from the ~/opt/anaconda3/envs/'yourEnvironmentName'/share/jupyter/kernels/python3/kernel.json inside it it should work. In the end you should have this folder structure: /Users/"yourUserName"/Library/Jupyter/kernels/python3/kernel.json .
@redmlr the instructions to install Miniforge are in the attached issue. Using miniforge is just like using conda -- the same conda commands you find online would work.
thank you @mwidjaja1, I already figured it out and created an environment, now I have to install the packages
@icenando, so I've tried, but I cannot change the kernel to the new one. Only the default is shown as on option.
@icenando, so I've tried, but I cannot change the kernel to the new one. Only the default is shown as on option.
Hmm, I would think that as you only have one kernel in the folder and only have the one option inside Jupyter, it must be the same kernel? Have you checked to see if it's working? Try this in jupyter:
import tensorflow as tf print(tf._ version _)
*There's no gap between the two underlines, but github won't print them otherwise. Just look up how to print Tensorflow's version.
@icenando, so I've tried, but I cannot change the kernel to the new one. Only the default is shown as on option.
Hmm, I would think that as you only have one kernel in the folder and only have the one option inside Jupyter, it must be the same kernel? Have you checked to see if it's working? Try this in jupyter:
import tensorflow as tf print(tf._ version _)
*There's no gap between the two underlines, but github won't print them otherwise. Just look up how to print Tensorflow's version.
the kernel dies
@icenando, so I've tried, but I cannot change the kernel to the new one. Only the default is shown as on option.
Hmm, I would think that as you only have one kernel in the folder and only have the one option inside Jupyter, it must be the same kernel? Have you checked to see if it's working? Try this in jupyter: import tensorflow as tf print(tf._ version _) *There's no gap between the two underlines, but github won't print them otherwise. Just look up how to print Tensorflow's version.
the kernel dies
Ah, sorry... I don't know what else to suggest then. I spend 3 months trying and this worked for me. Good luck!
@icenando, so I've tried, but I cannot change the kernel to the new one. Only the default is shown as on option.
Hmm, I would think that as you only have one kernel in the folder and only have the one option inside Jupyter, it must be the same kernel? Have you checked to see if it's working? Try this in jupyter: import tensorflow as tf print(tf._ version _) *There's no gap between the two underlines, but github won't print them otherwise. Just look up how to print Tensorflow's version.
the kernel dies
Ah, sorry... I don't know what else to suggest then. I spend 3 months trying and this worked for me. Good luck!
I'll keep trying, thank you!
I solved the "ERROR: numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform" by uninstalling the python 3.8 first and then re-installing it through the Xcode Command Line Tools. After that I ran the install script again and had no issues. If you install python directly it will not work and you will get the above error.
BTW I tested TF on M1 Mac Mini against TF on RTX 2080Ti and it ran 14% faster. I was so amazed that I posted it on Medium
Hello, how can we uninstall python in terminal ?
@alanspace you can uninstall python by using brew uninstall python
But that's only work if you installed python through brew.
You could also remove the python folder from the applications folder
@alanspace you can uninstall python by using
brew uninstall python
But that's only work if you installed python through brew.You could also remove the python folder from the applications folder
I think my mac mini with M! chip have python installed by default.
I type which python
, terminal leads me to /usr/bin/python3
, from there I cannot delete the python3 file.
https://www.youtube.com/watch?v=NLc9iB89VW8
I just simply install anaconda in terminal without using brew. https://www.youtube.com/watch?v=p8rty8Zwl_w
I have found a tutorial like this
step 1: Manually remove the Python folders from the Applications folder
step 2: Remove the Python Framework from the /Library directory
step 3: Remove Python symbolic links
https://www.macupdate.com/app/mac/5880/python/uninstall
I don't know if it really works.
And how can we install python in Xcode? I haven't played with Xcode before, the interface doesn't seem like terminal.
I have found the link to install xcode command line very easily.
https://www.youtube.com/watch?v=tQTpEbFxnLw
https://developer.apple.com/download/more/?=command%20line%20tools
I follow this tutorial to install the whl, but just like all of you stuck at step 10.
So I have my python in the directroy: miniforge3/bin/python3, which is not in the libary framework
4. /tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl
i am still getting this error: ERROR: grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl is not a supported wheel on this platform.
any idea why that is?
@jrlindell You could follow the instructions from @mwidjaja1 in #153, the installation process is very well documented there.
@alanspace this issue might worth to look at with your problem.
I am trying to install tensor flow in the new MacBook Pro M1 but it gives the error ERROR: numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform.