apple / tensorflow_macos

TensorFlow for macOS 11.0+ accelerated using Apple's ML Compute framework.
Other
3.66k stars 308 forks source link

M1 Importing Tensorflow from venv Kills Kernel #223

Closed dgupgu closed 3 years ago

dgupgu commented 3 years ago

I download TensorFlow within the virtual environment :

  1. % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
  2. . "/Users/darrengu/tensorflow_macos_venv/bin/activate"

I then open a Jupyter Notebook that has a cell with the import statement "import tensorflow as tf"

  1. pip install jupyterlab
  2. python -m notebook

When I run the cell that imports tensorflow, my Kernel dies. Any fixes for this?

ghost commented 3 years ago
  1. make sure your terminal is not being opened using Rosetta
  2. to install packages for your environment use: pip install --upgrade -t "${VIRTUAL_ENV}/lib/python3.8/site-packages/" PACKAGE_NAME
dgupgu commented 3 years ago

Thanks! Making sure to run terminal without Rosetta (using ARM, and not x86, architecture) worked for me