Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensorflow import Error #4645

Closed
MayaSakaguchi617 opened this issue Feb 4, 2021 · 7 comments
Closed

Tensorflow import Error #4645

MayaSakaguchi617 opened this issue Feb 4, 2021 · 7 comments
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)

Comments

@MayaSakaguchi617
Copy link

Issue Type: Bug

Tensorflow is already installed.

import tensorflow as tf

run the next cell
Error: Direct kernel connection broken

Extension version: 2020.12.414227025
VS Code version: Code 1.52.1 (ea3859d4ba2f3e577a159bc91e3074c5d85c0523, 2020-12-16T16:30:02.420Z)
OS version: Darwin x64 20.3.0

System Info
Item Value
CPUs Apple M1 (8 x 2400)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 8.00GB (0.03GB free)
Process Argv --crash-reporter-id 6d5cec51-b17c-464e-9bbd-a5aad282620e
Screen Reader no
VM 0%
@rchiodo rchiodo added kernel-crash notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) bug Issue identified by VS Code Team member as probable bug labels Feb 4, 2021
@rchiodo
Copy link
Contributor

rchiodo commented Feb 4, 2021

Thanks for the bug. This sounds like importing tensorflow caused the kernel to crash.

Are you using pytorch? That might be the issue if you don't install it according to pytorch's directions?
https://pytorch.org/get-started/locally/

Not really an expert on tensorflow or pytorch though.

@DonJayamanne
Copy link
Contributor

@MayaSakaguchi617
In addition to what @rchiodo has suggested, Please could you also enable logging & provide the output when you get the above error (please try this first before re-installing pytorch).

Please could you enable logging as follows:

  • Open settings & go into Jupyter->Logging
  • Change the value to debug
  • Reload VS Code,
  • Attempt to repro the issue & then copy the output from the Jupyter output panel.

@rchiodo would be good to see what errors are returned by kernel, this way when it happens in the future we can proactively ask user from extension to re-install pytorch with some instructions (ie. prevent user from having to report an issue - i.e. provide a way for them to resolve it at their end then and there...).

@MayaSakaguchi617
Copy link
Author

I really appreciate your advice.

Since I couldn't find Jupiter->Logging,
I tried to debug by following below.
https://code.visualstudio.com/docs/python/jupyter-support

---Result---
CODE
[ ]:import tensorflow as tf
[ ]:print('hello')

OUTPUT
(base) % source /Users/{username}/opt/anaconda3/bin/activate
(base) % conda activate base
(base) % /Users/{username}/opt/anaconda3/bin/python "{filename}.py"
zsh: illegal hardware instruction /Users/{username}/opt/anaconda3/bin/python
(base) %

@DonJayamanne
Copy link
Contributor

Since I couldn't find Jupiter->Logging,

Open your settings from the command palette & select Preferences: Open Settings UI
Screen Shot 2021-02-04 at 11 22 00

The reload VS Code after changing it to debug.
Run your cell & wait for the error Direct Kernel connection broken.
Go into your output panel Jupyter and copy the output & paste it here.
See here
Screen Shot 2021-02-04 at 11 23 49

@rchiodo
Copy link
Contributor

rchiodo commented Feb 4, 2021

Your python example indicates that tensorflow crashes without using VS code.

Sounds like a tensorflow bug. I believe this is the sort of thing that happens if you don't install pytorch using the directions (I had something similar happen to me). Or it could be that tensorflow isn't supported on your chip yet either.

See this issue here:
tensorflow/tensorflow#44999

@MayaSakaguchi617
Copy link
Author

@DonJayamanne Thanks for kind instruction.

I've just run the first line: import tensorflow as tf
The output was a little long, so I will attach a text file.

Log_1.txt

@greazer
Copy link
Member

greazer commented Feb 16, 2021

Please reopen this bug (or file in the tensorflow repo) if the above advice doesn't resolve your issue. Thanks!

@greazer greazer closed this as completed Feb 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)
Projects
None yet
Development

No branches or pull requests

4 participants