๊ฐ€์ƒํ™˜๊ฒฝ์—์„œ Jupyter Notebook ์‚ฌ์šฉ ์‹œ Kernel Died๋œจ๋Š” ์—๋Ÿฌ ํ•ด๊ฒฐ

2021. 9. 8. 07:17ใ†์˜ค๋ฅ˜ ํ•ด๊ฒฐ

์•„๋‚˜์ฝ˜๋‹ค์—์„œ ์ƒˆ๋กœ์šด ๊ฐ€์ƒํ™˜๊ฒฝ์„ ๋งŒ๋“ค์–ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. Environments์—์„œ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ์ƒ์„ฑ์ด ์™„๋ฃŒ๋ฉ๋‹ˆ๋‹ค.

 

 

 

์„ค์น˜ ํ›„์— ์ถ”๊ฐ€์ ์œผ๋กœ Python ๋ฒ„์ „์„ ์ƒˆ๋กœ ์„ค์น˜ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

 

๊ทธ ๋’ค์— tensorflow๋ฅผ ์„ค์น˜ํ–ˆ๊ณ , ํ„ฐ๋ฏธ๋„์—์„œ Tensorflow๊ฐ€ ์„ค์น˜๋˜์—ˆ๋‹ค๋Š” ๊ฑธ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

 

๊ทธ ํ„ฐ๋ฏธ๋„์—์„œ Jupyter Notebook๋ฅผ ์‹คํ–‰์‹œ์ผœ์„œ ๋ฐ”๋กœ 'import tensorflow as tf'๋กœ ์„ค์น˜๋ฅผ ํ™•์ธํ•˜๋ ค๊ณ  ํ•˜๋‹ˆ, 'Kernel Died'๋ผ๋Š” ๋ฌธ๊ตฌ๊ฐ€ ๋œจ๋ฉฐ ์•„๋ฌด๋ฆฌ ์—ฐ๊ฒฐ์„ ๋Š๊ณ  ์ƒˆ๋กœ ์‹œ์ž‘ํ•ด๋„ ์—ฌ์ „ํžˆ Run์ด ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

 

๊ทธ๋ž˜์„œ Stack Overflow์™€ Github์ด์Šˆ๋ฅผ ์ฐพ์•„๋ณด๋‹ˆ, ๋Œ€์ฒด๋กœ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ์—๋Ÿฌ์˜ ์ด์œ ๋ฅผ ์„ธ ๊ฐ€์ง€ ์ •๋„๋กœ ์ถ”๋ฆฌํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. 

 

1. Rosettaํ„ฐ๋ฏธ๋„์—์„œ ์˜คํ”ˆํ•˜์—ฌ ํ…์„œํ”Œ๋กœ์šฐ๋ฅผ ์„ค์น˜ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์—(https://github.com/apple/tensorflow_macos/issues/77)

2. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ• ๋•Œ conda install์ด ์•„๋‹ˆ๋ผ pip install์„ ์‚ฌ์šฉํ–ˆ๊ธฐ ๋•Œ๋ฌธ์—

3. Jupyter Notebook์— ์ปค๋„ ์—ฐ๊ฒฐ์„ ํ•ด์ฃผ์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ์—(https://stackoverflow.com/questions/39604271/conda-environments-not-showing-up-in-jupyter-notebook)

 

 

1. Rosetta ์„ค์ • ํ•ด์ œ

FInder์—์„œ 'ํ„ฐ๋ฏธ๋„'์„ ๊ฒ€์ƒ‰ํ•ด '์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ' ํด๋ฆญ

2. pip install(X) conda install(O)

 

anaconda์—์„œ ๋งŒ๋“  ๊ฐ€์ƒํ™˜๊ฒฝ์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, pip์ด ์•„๋‹ˆ๋ผ conda๋ผ๋Š” ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

์ด๋•Œ ์‹ค์ˆ˜๋กœ pip install tensorflow๋ฅผ ํ•ด ๋‘” ์ ์ด ์žˆ๋‹ค๋ฉด ์•ˆ์ „ํ•˜๊ฒŒ pip uninstall tensorflow๋ฅผ ํ•ด ์ค€ ๋’ค์— conda install๋ฅผ ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์„ ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค.

 

3. Jupyter Notebook ์ปค๋„ ์—ฐ๊ฒฐ

๊ณ„์†ํ•ด์„œ Kernel Died ์—๋Ÿฌ ๋ฉ”์„ธ์ง€๊ฐ€ ๋œจ๋‹ค๋ณด๋‹ˆ ์ด๊ฑฐ.. ์ปค๋„์ด ์—ฐ๊ฒฐ์ด ์•„์˜ˆ ์•ˆ๋˜์–ด ์žˆ๋Š” ๊ฑฐ ์•„๋‹๊นŒ? ํ•˜๋Š” ์˜๋ฌธ์ด ๋“ค์–ด์„œ virtual env kernel died์™€ ๊ฐ™์€ ํ‚ค์›Œ๋“œ๋กœ ๊ฒ€์ƒ‰์„ ํ•ด๋ณด๋‹ˆ ์˜ˆ์ƒ์ด ๋งž์•˜์Šต๋‹ˆ๋‹ค.

 

๋Œ€์ถฉ ๊ธ€์„ ์ฝ์–ด๋ณด๋‹ˆ ์˜ˆ์ „์—๋Š” ๊ฐ€์ƒ ํ™˜๊ฒฝ์„ ์„ค์น˜ํ•˜๋ฉด ์ž๋™์œผ๋กœ ์ปค๋„์ด ์—ฐ๊ฒฐ์ด ๋˜์—ˆ๋˜ ๊ฒƒ ๊ฐ™์€๋ฐ, ์ง€๊ธˆ์€ ๋”ฐ๋กœ ์—ฐ๊ฒฐํ•˜๋Š” ๊ณผ์ •์„ ๊ฑฐ์ณ์•ผ ํ•ฉ๋‹ˆ๋‹ค. 

 

conda install nb_conda_kernels

 

์ด ๋ช…๋ น์–ด๋Š” ๋‚ด ๊ฐ€์ƒํ™˜๊ฒฝ์„ ์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ ์ปค๋„์— ์—ฐ๊ฒฐํ•ด์ค๋‹ˆ๋‹ค(์ž์„ธํ•œ ์‚ฌํ•ญ: https://github.com/Anaconda-Platform/nb_conda_kernels)

 

GitHub - Anaconda-Platform/nb_conda_kernels: Package for managing conda environment-based kernels inside of Jupyter

Package for managing conda environment-based kernels inside of Jupyter - GitHub - Anaconda-Platform/nb_conda_kernels: Package for managing conda environment-based kernels inside of Jupyter

github.com

 

์ด๋ ‡๊ฒŒ ํ•ด์ค€ ๋’ค ๋‹ค์‹œ ์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ์„ ์ž‘๋™ ์‹œ์ผœ๋ณด๋ฉด

import tensorflow as tf

๊ฐ€ ์•„์ฃผ ์ž˜ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค!! ์˜ค๋Š˜๋„ ์—๋Ÿฌ ํ•ด๊ฒฐ ์™„๋ฃŒ๐Ÿ’ช๐Ÿป