Home > Net >  Cannot import TensorFlow on Mac M1
Cannot import TensorFlow on Mac M1

Time:03-24

I'm trying to run a shell script on Mac OS M1, but it keeps giving me the error:

ModuleNotFoundError: No module named 'tensorflow'

I followed the instructions from here: https://caffeinedev.medium.com/how-to-install-tensorflow-on-m1-mac-8e9b91d93706.

Although I now can import it manually in python:

(mlp) sarah@Air-Sarah AIR % python 
Python 3.8.11 (default, Aug 16 2021, 12:04:33) 
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.8.0'

my error in shell remains the same.

I also tried to install it with https://github.com/apple/tensorflow_macos. Nothing changed.

Also here it says that Python version has to be 3.8 for TensorFlow to be imported, but mine is 3.8.

What else can I do?

CodePudding user response:

I've been able to address this issue following this guide

  • Related