2

In a new virtual env, python 3.9 I tried to install tensorflow using pip

pip install tensorflow

I keep getting the error

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow

When following the installation guidelines I still have the following error :

RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import

I am using a M1 MacOS Monterey version 12.6.1

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
welu
  • 329
  • 3
  • 12
  • 2
    If you are on M1, you have to follow a few extra steps. There are several articles about it, you have to google "M1 tensorflow": https://caffeinedev.medium.com/how-to-install-tensorflow-on-m1-mac-8e9b91d93706 – Kokodoko Dec 23 '22 at 20:26
  • I tried that on many occasions still get the error ``` RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe ImportError: numpy.core._multiarray_umath failed to import ImportError: numpy.core.umath failed to import ``` – welu Dec 23 '22 at 21:12
  • Did you install numpy successfully? – OneCricketeer Dec 23 '22 at 21:17
  • yes numpy works fine – welu Dec 23 '22 at 21:21
  • Please see [this SO question](https://stackoverflow.com/questions/72964800/what-is-the-proper-way-to-install-tensorflow-on-apple-m1-in-2022) and [the official Apple instructions to install tensorflow-plugin](https://developer.apple.com/metal/tensorflow-plugin). A similar question was asked a few days ago: see [this](https://stackoverflow.com/questions/74850480/running-tensorflow-macos-2-11-0-give-runtime-error-on-apple-mac-m1#comment132095351_74850480). – medium-dimensional Dec 23 '22 at 21:27
  • did you try `pip3 install tensorflow` or `sudo pip3 install tensorflow` ? – Miguel Cardoso Dec 23 '22 at 21:36
  • I have to say, I still have install issues even after following all the above tips and questions. There are so many interconnecting packages and libraries, and if one is not installed correctly, it's quite hard to figure out where the problem is, or how to uninstall/reinstall everything :( – Kokodoko Dec 24 '22 at 09:23
  • Hi @WaelDimassi, Please refer to this official [documentation](https://www.tensorflow.org/install/source) for installing tensorflow. Thank You. –  Jan 11 '23 at 10:55

1 Answers1

0

Please try again installing TensorFlow on MacOS(M1) using Anaconda Navigator.

You can follow the below steps:

  • Step 1 : Download and Install the Anaconda CLI for Mac M1 (at bottom of the page)

  • Step 2 : Visit - https://brew.sh and copy and paste the command code in terminal - enter login password - enter (installing will be invisible as no activity)

  • Step 3 : Type> cd downloads (in terminal)

  • Step 4 : Type> bash Anaconda3-2023.03-1-MacOSX-arm64.sh
    (downloaded_anaconda_filename.sh) - enter (yes to license - enter to accept default location)

  • Step 5 : Type> cd \ (to go back to default location)

  • Step 6 : (To create conda Virtual Environment, Type,)

    conda create --name tfVirEnv
    conda activate tfVirEnv

  • Step 7 : (Install TensorFlow in VirEnv)

    pip install --upgrade pip
    pip install tensorflow #or
    conda install tensorflow

  • Step 8: (Verify if TensorFlow installed correctly, Type,)

    Python
    import tensorflow as tf
    tf._ _ version _ _

  • Step 9: Now you can open the Jupyter notebook through Anaconda Navigator application or can simply type below code in terminal

    conda install notebook
    jupyter notebook

Please have a look at this link for the reference. Thank you.

TF_Renu Patel
  • 356
  • 1
  • 4