

If everything has been installed without errors, running the following code in a jupyter notebook should correctly import TensorFlow and print out the version as well as verifying the presence of a GPU. Install jupyter notebook using conda install notebook. Sh ~/Downloads/Miniforge3-MacOSX-arm64.shĬreate a conda environment with Python 3.9: conda create -n tf_env python=3.9 (latest Python version didn't work as I'm writing this).Īt this point, you should make sure that the Numpy version is up to date to not run into errors when importing TensorFlow. bash file above, then do the following to start the installation:Ĭhmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh bash file seem to have worked, while for M2 both worked. pkg files should do - choose one of them. Currently, I'm not sure whether it's possible to install TensorFlow using Anaconda.ĭownload Miniconda3 using this link. If you want to use an Anaconda distribution, you might want to consider Miniconda3. Print("Number CPUs Available: ", len(tf._physical_devices('CPU'))) Print("Number GPUs Available: ", len(tf._physical_devices('GPU'))) Now, your TensorFlow installation has been completed!.Not using virtual env, run following: pip3 install -no-binary=h5py h5py Venv/bin/pip install -no-binary=h5py h5py To install Tensorflow and related libs, run following:.
#PIP3 INSTALL VIRTUALENV MAC#
#PIP3 INSTALL VIRTUALENV DOWNLOAD#
Install hdf5 by running brew install hdf5 if you do not have brew, you can download it here: Ībove hdf5 install will spit out its location: use it and run:Įxport HDF5_DIR= for version 1.13.0 (my case) the following:Įxport HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.13.0 There are quite a few things to do in order to install TensorFlow on the Macbook M1 chip:įirst, install Python 3.8.9 (I have tried on this version, not sure about any other versions) Include the entire stack traceĪbove this error message when asking for help. Packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrongįailed to load the native TensorFlow runtime.įor some common reasons and solutions. Users/imantha/Software/anaconda3/envs/mlEnv/lib/python3.8/site. Packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image Packages/tensorflow/python/pywrap_tensorflow.py", line 64, in ĭlopen(/Users/imantha/Software/anaconda3/envs/mlEnv/lib/python3.8/site. ImportError: Traceback (most recent call last): Packages/tensorflow/python/pywrap_tensorflow.py", line 83, in Packages/tensorflow/python/_init_.py", line 39, in įrom tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow Packages/tensorflow/_init_.py", line 41, in įrom import module_util as _module_util Users/imantha/Software/anaconda3/envs/mlEnv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architectureĭuring handling of the above exception, another exception occurred:įile "/Users/imantha/Software/anaconda3/envs/mlEnv/lib/python3.8/site. ImportError: dlopen(/Users/imantha/Software/anaconda3/envs/mlEnv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found.

However when I start python session in the shell and type import tensorflow as tf, I get the following error Traceback (most recent call last):įile "/Users/imantha/Software/anaconda3/envs/mlEnv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in įrom tensorflow.python._pywrap_tensorflow_internal import * tensorflow was successfully installed and when typed conda list, the package is listed.When prompted to input the path : /Users/imantha/Software/anaconda3/envs/mlEnv/.

