'Expected in: /usr/lib/libc++.1.dylib': Installing Tensorflow on M1 MacBook Pro
Asked Answered
H

1

5

I am trying to install Tensorflow on my MacBook Pro with the M1 chip. The operating system of my MacBook is MacOS Big Sur Version 11.0.

enter image description here

In order to install Tensorflow to use it with Python, I have followed this tutorial, which says that I have to do the following:

  1. Install Homebrew.

  2. Download MiniForge3 for macOS arm64 chips (link provided in the webpage).

  3. Install MiniForge3 using:

    chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
    sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
    source ~/miniforge3/bin/activate
    
  4. Create a folder to set up an environment for Tensorflow.

    mkdir tensorflow-test
    cd tensorflow-test
    
  5. Make and activate Conda environment.

    conda create --prefix ./env python=3.9.7
    conda activate ./env
    
  6. Install Tensorflow dependencies.

    conda install -c apple tensorflow-deps
    python -m pip install tensorflow-macos
    python -m pip install tensorflow-metal
    

After this, I open a Jupyter Notebook and I try to import tensorflow, but this error shows up:

OSError: dlopen(/Users/blancoarnau/tensorflow-test/env/lib/python3.9/site-packages/tensorflow/python/platform/../../core/platform/_cpu_feature_guard.so, 6): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
   Referenced from: /Users/blancoarnau/tensorflow-test/env/lib/python3.9/site-packages/tensorflow/python/platform/../../core/platform/_cpu_feature_guard.so (which was built for Mac OS X 12.3)
   Expected in: /usr/lib/libc++.1.dylib

As you can see in this screenshot:

enter image description here

Do you have an idea why this is happening?

Hershel answered 18/2, 2022 at 13:30 Comment(2)
does updating to Mac OS X 12.3 work @Arnau?Reich
@Reich Yes, it does!Hershel
P
6

check the message details: (which was built for Mac OS X 12.3)

you need to upgrade macOS to 12.3

Podiatry answered 18/2, 2022 at 20:6 Comment(4)
Does it working after updating?? Can anyone tellMicrosporangium
@RanaBest, did you try?Reich
Yes, I did and it worked!Hershel
I confirm that this solution works.Reich

© 2022 - 2024 — McMap. All rights reserved.