8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jupyter でファイルをダウンロードしようとすると「失敗 - アクセスできません」

Last updated at Posted at 2019-07-10

jupyter lab でファイルをダウンロードしようとすると,「失敗 - アクセスできません」となり,ダウンロードリンクからアクセスしたり,jupyter lab のログを見ると「403 forbidden」や「Blocking request from unknown origin」となっている時の解決方法です。

ちなみに safari ならダウンロードできるという情報もありますので,safari 環境がある方は safari を使う方が早いかもしれません。
実際に safari であればダウンロードを問題なく行えました!
ただし,ダウンロードリンクについては safari でも機能しませんのでご注意を。


(2020/1/24 追記)

  • notebook 6.0.3 で改善されていることを確認しました!
    • ファイルツリーから右クリックでのダウンロードが chrome でできることを確認
  • ダウンロードリンクは機能しないことを確認しました (chrome 環境にて)

(2019/7/25 追記)

  • notebook 6.0.0 でも chrome でダウンロードできない現象を確認しました
  • safari ではダウンロードが問題なく行えることを確認しました
  • ダウンロードリンクについては safari でも機能しないことを確認しました

TL;DR

pipenvユーザ
$ pipenv install notebook==5.7.5  # 古いバージョンに落とす
$ pipenv install notebook>=6.0.3  # 新しいバージョンに更新する
# $ pipenv install notebook\>=6.0.3  # 私の環境ではエスケープ文字が必要だった
pipユーザ
$ pip install notebook==5.7.5  # 古いバージョンに落とす
$ pip install notebook>=6.0.3  # 新しいバージョンに更新する

起動時のオプションで --NotebookApp.disable_check_xsrf=True を渡すとこのエラーを回避できる可能性があります。

検証し次第,記事を更新したいと思います。


環境

  • notebook 5.7.6 以降 (5.7.6, 5.7.7, 5.7.8, 6.0.0)
  • chrome 75.0 など

詳細

jupyter lab のログを確認すると以下のようになっていました。

log
[W <time> LabApp] Blocking request with no referer
[W <time> LabApp] 403 GET <file_path> (<client ip>): Blocking request from unknown origin
[W <time> LabApp] 403 GET <file_path> (<client ip>) 8.51ms referer=None

次を実行すると notebook 5.7.8 がインストールされているのがわかります。

$ pipenv run pip freeze | grep notebook
notebook==5.7.8

そこでisuueを参考に冒頭のコマンドを実行して jupyter lab を再起動したところ無事解消しました。

$ pipenv install notebook==5.7.5                                                                                                                                                             

(2020/2/10 追記)

更新しても解消することを確認しました。

$ pipenv install notebook>=6.0.3                                                                                                                                                             

めでたしめでたし

参考

8
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?