apple / tensorflow_macos

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

Kernel crashes anytime ! #45

Open jmbernabotto opened 3 years ago

jmbernabotto commented 3 years ago

I installed tensorflow in my new Mac mini M1. I followed instructions to make new environnement... But with Jupyter when I try "import tensorflow", I have a kernel crash systematically ! Please help me.

Thanks.

leach-mrt commented 3 years ago

I also met the same problen in my new MacBook Pro M1, but run python script w/o jupyter-notebook is fine.

jmbernabotto commented 3 years ago

I also met the same problen in my new MacBook Pro M1, but run python script w/o jupyter-notebook is fine.

I also tried this way but same issue !

LeonardoAlchieri commented 3 years ago

Since there are other issues open about Jupyter on Intel Macs as well, I believe it may be some bug related to the use of the Metal Shaders with the ipython kernel.

anna-tikhonova commented 3 years ago

Thank you for reporting this issue! It would be very helpful, if you could provide a reproducible test case, so we can investigate this failure.

jmbernabotto commented 3 years ago

Oh it’s very simple. Import tensorflow as tf and ...bing...kernel crash ! and below the return message after a test.py where there is unique instruction : import tensorflow as tf

Traceback (most recent call last):   File "test.py", line 1, in     from sklearn.linear_model import LinearRegression ModuleNotFoundError: No module named 'sklearn' (tensorflow_macos_venv) (base) xavier@Mac-mini-de-Xavier bin % cd.. zsh: command not found: cd.. (tensorflow_macos_venv) (base) xavier@Mac-mini-de-Xavier bin % cd.. zsh: command not found: cd.. (tensorflow_macos_venv) (base) xavier@Mac-mini-de-Xavier bin % pip3 install scikit-learn Collecting scikit-learn   Using cached scikit_learn-0.23.2-cp38-cp38-macosx_10_9_x86_64.whl (7.2 MB) Collecting threadpoolctl>=2.0.0   Using cached threadpoolctl-2.1.0-py3-none-any.whl (12 kB) Requirement already satisfied: numpy>=1.13.3 in /Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages (from scikit-learn) (1.18.5) Collecting scipy>=0.19.1   Using cached scipy-1.5.4-cp38-cp38-macosx_10_9_x86_64.whl (29.0 MB) Collecting joblib>=0.11   Using cached joblib-0.17.0-py3-none-any.whl (301 kB) Installing collected packages: threadpoolctl, scipy, joblib, scikit-learn Successfully installed joblib-0.17.0 scikit-learn-0.23.2 scipy-1.5.4 threadpoolctl-2.1.0 (tensorflow_macos_venv) (base) xavier@Mac-mini-de-Xavier bin % python test.py (tensorflow_macos_venv) (base) xavier@Mac-mini-de-Xavier bin % nano test.py   (tensorflow_macos_venv) (base) xavier@Mac-mini-de-Xavier bin % python test.py Traceback (most recent call last):   File "/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in     from tensorflow.python._pywrap_tensorflow_internal import * ImportError: dlopen(/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found.  Did find:     /Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture     /Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "test.py", line 1, in     import tensorflow as tf   File "/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/init.py", line 41, in     from tensorflow.python.tools import module_util as _module_util   File "/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/init.py", line 39, in     from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow   File "/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 83, in     raise ImportError(msg) ImportError: Traceback (most recent call last):   File "/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in     from tensorflow.python._pywrap_tensorflow_internal import * ImportError: dlopen(/Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found.  Did find:     /Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture     /Users/xavier/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace above this error message when asking for help.

Le 1 déc. 2020 à 18:55, anna-tikhonova notifications@github.com a écrit :

 Thank you for reporting this issue! It would be very helpful, if you could provide a reproducible test case, so we can investigate this failure.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pooyadavoodi commented 3 years ago

@jmbernabotto I wasn't able to reproduce the issue. Jupyter seems to be working for me.

Perhaps this is due to some installation issue?

Have you installed python from Xcode Command Line Tools as mentioned in the readme file? I've noticed only this version of python have be used to create any virtual environment or to install pip packages.

jmbernabotto commented 3 years ago

@jmbernabotto I wasn't able to reproduce the issue. Jupyter seems to be working for me.

Perhaps this is due to some installation issue?

Have you installed python from Xcode Command Line Tools as mentioned in the readme file? I've noticed only this version of python have be used to create any virtual environment or to install pip packages.

Yes I have installed Python from Xcode. No solution for me 👎 so disappointed...

jmbernabotto commented 3 years ago

I tested that. Same issue ! I’m going to begin again all instructions !

Le 11 déc. 2020 à 18:45, Hoyt Koepke notifications@github.com a écrit :

pip install --upgrade appnope

hoytak commented 3 years ago

Ipython requires the latest version of appnope (pip install --upgrade appnope) to work correctly on M1. However, I do not think that is the issue here.

First, could you verify that outside of your virtual environment, running which python points to the Python version installed by the command line tools. If it doesn't, then run the install script using --python=/Library/Developer/CommandLineTools/usr/bin/python3 to force it to use the command line tools version.

If that doesn't work, send me the output of file $(which python) while in your virtual environment. There are two cpu subtypes for binaries on the M1, arm64 and arm64e. Trying to mix the two results in the error you see. For this pre-release version, we're focusing support on the arm64 version of Python in the Xcode Command Line Tools, so the included wheel does not include an arm64e slice.

jmbernabotto commented 3 years ago

I don't test yet

Yueqi-19 commented 3 years ago

me too, so disappointed! when i try to import TensorFlow, it always showed 'kernel appears to have died. It will restart automatically'

jisho-iemoto commented 3 years ago

Me, too! I'm very looking forward to find how fast my machine works, but I haven't seen it yet, only the 'kernel crash' notice instead :<

dhoelzer commented 3 years ago

Random crashes during training several epochs in.

MegansColorado commented 3 years ago

Ipython requires the latest version of appnope (pip install --upgrade appnope) to work correctly on M1. However, I do not think that is the issue here.

First, could you verify that outside of your virtual environment, running which python points to the Python version installed by the command line tools. If it doesn't, then run the install script using --python=/Library/Developer/CommandLineTools/usr/bin/python3 to force it to use the command line tools version.

If that doesn't work, send me the output of file $(which python) while in your virtual environment. There are two cpu subtypes for binaries on the M1, arm64 and arm64e. Trying to mix the two results in the error you see. For this pre-release version, we're focusing support on the arm64 version of Python in the Xcode Command Line Tools, so the included wheel does not include an arm64e slice.


Having same issue. When I do this line --python=/Library/Developer/CommandLineTools/usr/bin/python3 I get '-bash: --python=/Library/Developer/CommandLineTools/usr/bin/python3: No such file or directory'

I did install from Command line.

When i do this line 'file $(which python)` i get '/Users/megan/opt/anaconda3/bin/python: Mach-O 64-bit executable x86_64'

Can you please help?

dhoelzer commented 3 years ago

I seem to be finding that every minor MacOS update requires me to reinstall the command line tools... Is it possible that you've allowed your Mac to do a minor update, which oddly results in the command line tools getting flushed?

MegansColorado commented 3 years ago

I seem to be finding that every minor MacOS update requires me to reinstall the command line tools... Is it possible that you've allowed your Mac to do a minor update, which oddly results in the command line tools getting flushed?

I just installed the latest command-line tools (that wasnt currently in beta) version 12.4 here: https://developer.apple.com/download/more/?=command%20line%20tools

jmbernabotto commented 3 years ago

Success for Tensorflow installation with the new procedure ; it’s ok with Jupiter notebook, but, there is a minor problem with matplotlib. I need to make few shift Enter to proceed successfully.

A major problem, Sickit Learn crash in Tensorflow Anaconda activation. I have to create another environment named sciait for example, with pandas, numpy…without tensorflow and there, no problem.

For me it’s a great convenience.

Have you the same difficulty ?

Le 17 mars 2021 à 18:33, MegansColorado @.***> a écrit :

I seem to be finding that every minor MacOS update requires me to reinstall the command line tools... Is it possible that you've allowed your Mac to do a minor update, which oddly results in the command line tools getting flushed?

I just installed the latest command-line tools (that wasnt currently in beta) version 12.4 here: https://developer.apple.com/download/more/?=command%20line%20tools https://developer.apple.com/download/more/?=command%20line%20tools — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apple/tensorflow_macos/issues/45#issuecomment-801273671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJDEUSMQWHVMYHFIDX4KCZLTEDRXPANCNFSM4UGVEV3A.

sedwardsmarsh commented 3 years ago

Ipython requires the latest version of appnope (pip install --upgrade appnope) to work correctly on M1. However, I do not think that is the issue here.

First, could you verify that outside of your virtual environment, running which python points to the Python version installed by the command line tools. If it doesn't, then run the install script using --python=/Library/Developer/CommandLineTools/usr/bin/python3 to force it to use the command line tools version.

If that doesn't work, send me the output of file $(which python) while in your virtual environment. There are two cpu subtypes for binaries on the M1, arm64 and arm64e. Trying to mix the two results in the error you see. For this pre-release version, we're focusing support on the arm64 version of Python in the Xcode Command Line Tools, so the included wheel does not include an arm64e slice.

I found that passing --python = /usr/bin/python3 to the installation script worked and --python=/Library/Developer/CommandLineTools/usr/bin/python3 did not.

I go into further detail into the installation process I used in #215.