3

I've followed every step of this question

Install a venv: python3 -m venv venv. drag the install_venv.sh (which is located within the downloaded folder) file to the terminal, add -p at the end. select the directory of the venv as the location where tensorflow should be installed. activate the venv. type "python".

Try to import tensorflow: import tensorflow as tf.

I'm running my terminal not rosetta (which was the solution to the other problem):

(base) user@useros ~ % uname -m
arm64

When I activate my environment I still get:

(venv) (base) user@useros ~ % uname -m
arm64

If I run file $(which python) I get the following: On base:

(base) user@useros ~ % file $(which python)
/Users/user/opt/anaconda3/bin/python: Mach-O 64-bit executable x86_64

On venv:

(venv) (base) user@useros ~ % file $(which python)
/Users/user/venv/bin/python: Mach-O 64-bit executable x86_64

Why do I get 'Mach-O 64-bit executable x86_64' here even though I get 'arm64' before? This confuses me and is probably the reason why my code is not working.

Areza
  • 5,623
  • 7
  • 48
  • 79
Malte
  • 91
  • 1
  • 1
  • 8
  • Because you're picking up a different Python installation. You can see it printed the path to the executable, and it changed – Useless Jan 29 '21 at 09:35

2 Answers2

5

For Macbook pro M1, Tensorflow support is still ongoing. Please take a look at this comment.

  • Still not available. No wonder my Tensorflow vs Pytorch debate is not a thing anymore... – Mike Jan 11 '23 at 07:10
0

Try creating conda env with miniforge3 and install TensorFlow on the M1

Tensorflow on Apple M1 Pro and M1 Max

If not interested in miniforge3 the following worked for me:

tensorflow.org pip install instructions

zerocog
  • 1,703
  • 21
  • 32