質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Jupyter

Jupyter (旧IPython notebook)は、Notebook形式でドキュメント作成し、プログラムの記述・実行、その実行結果を記録するツールです。メモの作成や保存、共有、確認などもブラウザ上で行うことができます。

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

Q&A

解決済

1回答

1161閲覧

anacondaからjupyter-notebookを開くとエラーが出る

wasshoikimura

総合スコア10

Jupyter

Jupyter (旧IPython notebook)は、Notebook形式でドキュメント作成し、プログラムの記述・実行、その実行結果を記録するツールです。メモの作成や保存、共有、確認などもブラウザ上で行うことができます。

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

0グッド

0クリップ

投稿2019/11/18 09:50

編集2019/11/19 09:20

<環境>
Linux
18.04.3 LTS (Bionic Beaver)
Anaconda 64bit
NVIDIA-SMI 430.50
Driver Version: 430.50
CUDA Version: 10.1

jupyter-notebookを開くと以下のようなエラーが出てしまい、作業ができません。
どなたか助けてください。
tensorflowを使いたくて環境構築して色々やっていくうちにエラーが発生してしまいました。

tensorflow2.0-gpuをcondaコマンドで作った「myenv」という仮想環境にインストール

→jupyter-notebook上で環境を切り替えたいのでhttps://qiita.com/tomochiii/items/8b937f15c79a0c3eae0eを参考にしてmyenvを選択できるようにする

→tensorflow2.0-gpuが使いにくかったので、「test」という仮想環境をcondaコマンドで作り、  tensorflow1.13.1-gpuをcondaコマンドでインストール

→端末でtest環境に入りjupyter-notebookを開くとなぜかtensorflow2.0-gpuが開いてしまう。(anadonda-navigatorから入っても同じでした)

→myenvを削除しtest環境からjupyter-notebookを開くとkernelエラーが出て動か(なぜかjupyter-notebook上で消えたはずのmyenvが残っており、python3のボタンを押してテキストを作成しようとするとkernelエラーが出る。(逆にmyenvを選択するとエラーはでない)

→anacondaを削除しもう一度インストールし直す

→「test」という仮想環境をcondaコマンドで作り、tensorflow1.13.1-gpuをcondaコマンドでインストール

→test環境に入ってjupyter-notebookに入ると以下のエラーが発生

→bootでjupyter-notebookを開くと消えたはずのmyenvが残っており、python3のボタンを押してテキストを作成しようとするとkernelエラーが出る。逆にmyenvを選択するとエラーはでない

kernel.jsonを検索すると 
/home/spi/.local/share/jupyter/kernels/python3

/home/spi/anaconda3/share/jupyter/kernels/myenv

/home/spi/anaconda3/share/jupyter/kernels/python3

/home/spi/anaconda3/envs/test/share/jupyter/kernels/python3

/home/spi/anaconda3/pkgs/ipykernel-5.1.3-py37h39e3cac_0/share/jupyter/kernels/python3

/home/spi/anaconda3/pkgs/ipykernel-5.1.2-py37h39e3cac_0/share/jupyter/kernels/python3
がありました。

補足情報で、anacondaを入れ直す前のpython3のバージョンが3.6.8で入れ直したあとに確認すると3.7.5になっていました(端末python3 -Vで確認)

[I 18:39:36.990 NotebookApp] The port 8888 is already in use, trying another port.
[I 18:39:36.990 NotebookApp] The port 8889 is already in use, trying another port.
[I 18:39:36.990 NotebookApp] The port 8890 is already in use, trying another port.
[I 18:39:36.991 NotebookApp] The port 8891 is already in use, trying another port.
[I 18:39:36.991 NotebookApp] The port 8892 is already in use, trying another port.
[I 18:39:36.993 NotebookApp] Serving notebooks from local directory: /home/spi
[I 18:39:36.993 NotebookApp] The Jupyter Notebook is running at:
[I 18:39:36.993 NotebookApp] http://localhost:8811/?token=c502a27ea54af7bc58e95a006780fe3bb079fa2ae01d7841
[I 18:39:36.993 NotebookApp] or http://127.0.0.1:8811/?token=c502a27ea54af7bc58e95a006780fe3bb079fa2ae01d7841
[I 18:39:36.993 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:39:37.021 NotebookApp]

To access the notebook, open this file in a browser:
file:///home/spi/.local/share/jupyter/runtime/nbserver-19365-open.html
Or copy and paste one of these URLs:
http://localhost:8811/?token=c502a27ea54af7bc58e95a006780fe3bb079fa2ae01d7841
or http://127.0.0.1:8811/?token=c502a27ea54af7bc58e95a006780fe3bb079fa2ae01d7841
[E 18:39:43.289 NotebookApp] Failed to run command:
['/home/spi/anaconda3/envs/myenv/bin/python', '-m', 'ipykernel_launcher', '-f', '/home/spi/.local/share/jupyter/runtime/kernel-fb044383-7456-41da-a707-8e455ac4f47c.json']
PATH='/home/spi/anaconda3/envs/test/bin:/home/spi/anaconda3/condabin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
with kwargs:
{'stdin': -1, 'stdout': None, 'stderr': None, 'cwd': '/home/spi/tensorflow', 'start_new_session': True}

[E 18:39:43.290 NotebookApp] Uncaught exception POST /api/sessions (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8811', method='POST', uri='/api/sessions', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/notebook/services/sessions/handlers.py", line 72, in post
type=mtype))
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/jupyter_client/manager.py", line 259, in start_kernel
**kw)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "/home/spi/anaconda3/envs/test/lib/python3.7/site-packages/jupyter_client/launcher.py", line 138, in launch_kernel
proc = Popen(cmd, **kwargs)
File "/home/spi/anaconda3/envs/test/lib/python3.7/subprocess.py", line 800, in init
restore_signals, start_new_session)
File "/home/spi/anaconda3/envs/test/lib/python3.7/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/spi/anaconda3/envs/myenv/bin/python': '/home/spi/anaconda3/envs/myenv/bin/python'
[W 18:39:43.291 NotebookApp] Unhandled error
[E 18:39:43.292 NotebookApp] {
"Host": "localhost:8811",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0",
"Accept": "application/json, text/javascript, /; q=0.01",
"Accept-Language": "ja,en-US;q=0.7,en;q=0.3",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/json",
"X-Xsrftoken": "2|0960e6be|8a75ac2e5fc8d3f81419f56dee011da4|1573710122",
"X-Requested-With": "XMLHttpRequest",
"Content-Length": "106",
"Origin": "http://localhost:8811",
"Connection": "keep-alive",
"Referer": "http://localhost:8811/notebooks/tensorflow/MNIST_3layer.ipynb",
"Cookie": "username-localhost-8888="2|1:0|10:1574066571|23:username-localhost-8888|44:NjlhZWZjOTQwMjM0NGVlMGIyZTIwYzkwYmJhZGZiOTE=|12c791580eb603a15d2137861eb00d0c328ac02235887f51b2676bb048eac849"; _xsrf=2|0960e6be|8a75ac2e5fc8d3f81419f56dee011da4|1573710122; username-localhost-8889="2|1:0|10:1574066672|23:username-localhost-8889|44:ZjQ1ZDYzMDY1YzQwNDNlMGFlZGNlZGYwMjFhZTIyMGI=|1db0d2058b2444a64a9ec34d4bba11924407670281bc80c7f416227c1ed4ec22"; username-localhost-8890="2|1:0|10:1574067460|23:username-localhost-8890|44:YzE2ZTM4NGU3MzVjNGQ4NzkxYjEwOTJmNzY4NTEwMDk=|94da526d38766e74e786377e2c4182a33033eb72e3b924bb953c5d0ca4bab545"; username-localhost-8891="2|1:0|10:1574068575|23:username-localhost-8891|44:MmZlZDI5NzE0YjRiNDQwZTk5ZGMxMGEwMGRmN2I4NWY=|401e362e1e904a0051962eddjupyter-notebook6f3e9ae509fc0d307c5b36f7fbd3b56caf31f937"; username-localhost-8892="2|1:0|10:1574068583|23:username-localhost-8892|44:NzA2ZWFhZjdjYTU5NDNiYmE5YjE3ZTEyMDE2NDYzYjU=|36a386449b212b6286fb36b550d50d94bdf51388568e3f1ac7fa579b2477a20c"; username-localhost-8964="2|1:0|10:1574049771|23:username-localhost-8964|44:YzUzZDhjMDBkZDkwNGMwYjliNzU1NmY0Yzc1ODM5ZDY=|e4c87a57822cce4eaa21cda2da20b1c154b793dc9d89b41c9d2b907b5487e324"; username-localhost-8881="2|1:0|10:1574068866|23:username-localhost-8881|44:ZTJmOWM1YWRmYTYxNGYwNjg5ODlhYmI2OWU3MGRhZmQ=|dabfca25d1631afd995cc827f683f4ebaa52bcf333a6e70795442d9a50035929"; username-localhost-8902="2|1:0|10:1574069190|23:username-localhost-8902|44:NGQwZDEwNGU2N2VhNDlkYmFjZDBmYTUzMjE4ZTdmZjc=|dd88f5671729e0f26d4ae6d9dfe0fdf5bd1150a3c8865bc1196bb79530a67068"; username-localhost-8847="2|1:0|10:1574069531|23:username-localhost-8847|44:YjkyN2FhYjVhOTdmNDllMTkwOGRmYzQxZWQ1OWMxYzY=|051268c65066cd734583387e2447ef3746755804a89adb8488368f6289b85512"; username-localhost-8811="2|1:0|10:1574069978|23:username-localhost-8811|44:NzIyMzdlMmEyM2JiNDA5MWEyNDYyODZjNmE5ZTY0YjY=|e1aefd302a21ba7c6148e58c5b584abf877e3d2ddf39f4d05f4e0a3e3c08432e""
}
[E 18:39:43.292 NotebookApp] 500 POST /api/sessions (127.0.0.1) 13.26ms referer=http://localhost:8811/notebooks/tensorflow/MNIST_3layer.ipynb

本当に助けてほしいです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

cateye

2019/11/18 10:31 編集

環境も何も書かないのですか? →https://teratail.com/help/avoid-asking →https://insilico-notebook.com/conda-broken/
tiitoi

2019/11/20 04:30

Anaconda のアンインストールは Anaconda のフォルダを削除しましたか? いろいろ弄っておかしくなってしまったのかもしれないので、もう一度 Anaconda を再インストールしてはどうでしょうか。
wasshoikimura

2019/11/20 04:39

回答ありがとうございます。 jupyter notebookは諦めてvisual codeで動かすとうまくいきました。
guest

回答1

0

自己解決

jupyternotebookは諦めてvisualcodeで動かした。

投稿2019/11/20 04:40

wasshoikimura

総合スコア10

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問