1

I have Jupyter Notebooks running through Anaconda on my Mac computer.

I installed tensor flow using pip install tensorflow and I have the latest version of python.

For some reason, every time I run import tensorflow in jupyter notebooks, my kernel immediately fails.

I can run other functions and I can import other packages with no issue.

Cauder
  • 2,157
  • 4
  • 30
  • 69
  • pls check this thread https://stackoverflow.com/q/52016532/15358800 – Bhargav - Retarded Skills Jan 31 '22 at 18:26
  • Does this have to do with the Apple silicon? – Cauder Jan 31 '22 at 18:27
  • check this thread https://stackoverflow.com/a/59577414/15358800 it is related to Apple silicon – Bhargav - Retarded Skills Jan 31 '22 at 18:31
  • do you think a nvidia laptop is the best kind for deep learning? – Cauder Jan 31 '22 at 18:33
  • If you are beginner or moderately builds deep learning models your normal Laptop is fine. If you want to run high end models I recommend not fall on trap of high configuration laptops. Simply use google colab, Aws they are absolutely free & fast. alos ready to use platforms – Bhargav - Retarded Skills Jan 31 '22 at 18:46
  • Continuation... If you really want to run models on your own laptop. Build models on this Colab, Aws & make them as pre trained models Example: Keras pre trained models. You can actually do lots of interesting stuff with pretrained models - look up transfer learning. For example you can use couple of lower-level layers from network trained on ImageNet as feature extractor, and then put several fully connected layers on top of that, and train it on relatively small dataset with decent results, and it will work even on smaller machines (I recently did something similar without even using GPU). – Bhargav - Retarded Skills Jan 31 '22 at 18:47
  • Awesome, so it sounds like a) don't bother with a fancy computer because I can use the cloud and b) my apple silicon is good enough for messing around. Is that fair? – Cauder Jan 31 '22 at 20:15
  • Could you please try with this pip install --upgrade numpy in case the issue exist please uninstall tensorflow and install again. If you are using Gpu please follow this:`import tensorflow as tf` config = tf.ConfigProto() config.gpu_options.allow_growth = True Now when creating your session pass this config to it. sess = tf.Session(config=config)` You may also refer to [this issue] (https://github.com/tensorflow/tensorflow/issues/9829) –  Feb 09 '22 at 05:41

1 Answers1

0

If you are on Apple Silicon M1 chip, then tensorflow is not supported by your hardware and you need to go with Apple's own tensorflow-macos. However, installing it requires somewhat long but straightforward steps utilizing MiniForge. The steps can be found at this link.

Khaled Alanezi
  • 351
  • 4
  • 12
  • Is Apple Silicon M1 generally bad at running neural nets? It looks like NVIDIA GPU is where all the best machines are, I wonder if Macs just really aren't very good at this – Cauder Feb 06 '23 at 14:38
  • I would say in terms of performance, the M1 chip has performance suitable for running neural nets. It is just that TensorFlow doesn't support M1 officially yet. So, you will have to install tensorflow-macos package maintained by apple instead. – Khaled Alanezi Feb 08 '23 at 08:25