5: 2020-08-16 (日) 18:18:23 iseki |
現: 2023-04-26 (水) 09:34:57 iseki |
| * Jupyter [#ud5a4e75] | | * Jupyter [#ud5a4e75] |
| + | - python で書かれた Webアプリケーションによる教育・開発用環境 |
| + | - see also : [[JupyterHub]] (マルチユーザ用 Jupiter サーバ) |
| + | - see also : [[Python]] |
| + | #br |
| + | |
| ** Jupyter Notebook [#d5ab1922] | | ** Jupyter Notebook [#d5ab1922] |
| + | - クライアント・サーバモデルであるが,基本的に個人(シングルユーザ)用 |
| + | #br |
| | | |
| *** With Anaconda [#wf6eba52] | | *** With Anaconda [#wf6eba52] |
| - 色々調べると [[Anaconda]] の方が使い易い様子.というか,Anaconda には最初からデフォルトで Jupyter Notebook が入っている! | | - 色々調べると [[Anaconda]] の方が使い易い様子.というか,Anaconda には最初からデフォルトで Jupyter Notebook が入っている! |
| | | |
- | - (base) jupyter notebook --allow-root | + | - (base) jupyter notebook --allow-root --ip=0.0.0.0 |
- | - (base) jupyter lab --allow-root | + | - (base) jupyter lab --allow-root --ip=0.0.0.0 |
| + | #br |
| + | - その後,「データサインティスト以外は Anaconda は使用しばい方が良い」との記事を見つける. |
| + | -- Anacondaでは足りないパッケージがあって,結局 pip でそれらを追加していくと,どこかで環境が破壊される可能性があるみたい. |
| #br | | #br |
| | | |
| *** Install [#nb5b4afb] | | *** Install [#nb5b4afb] |
- | INSTALL | + | **** anaconda [#b557ba40] |
- | (base) conda install -c conda-forge notebook | + | - anaconda を入れる |
| + | - anaconda 環境で conda を使ってインストールする |
| + | (base) # conda install -c conda-forge notebook |
| + | |
| + | - C/C++ サポート |
| + | (base) # conda install -c conda-forge xeus-cling |
| + | (base) # pip install jupyter_c_kernel |
| + | (base) # install_c_kernel --sys-prefix |
| + | (base) # jupyter kernelspec list |
| + | - ''xeus-cling'' は anaconda 環境 (conda init) でないとインストールできないかも |
| + | - install_c_kernel で --sys-prefix を付けないと,C用のカーネルがユーザ環境に入る.削除する場合は ''jupyter kernelspec remove c'' |
| #br | | #br |
| + | |
| + | **** pip を使用する. [#d08d0c8f] |
| + | yum install nodejs |
| + | yum install python3-pip |
| + | pip install numpy scipy matplotlib seaborn scikit-learn pandas psycopg2 ipython-sql pymysql |
| + | pip install jupyter |
| + | pip install notebook |
| + | pip install jupyterlab |
| + | jupyter notebook --version |
| + | jupyter lab --versopn |
| + | #br |
| + | |
| + | *** 設定 [#m0eb2396] |
| + | 以下のコマンドで設定ファイル ''~/.jupyter/jupyter_notebook_config.py'' が生成される |
| + | (base) # jupyter notebook --generate-config |
| + | - リモートマシンからの接続を許可するには ''c.NotebookApp.ip = '0.0.0.0' ''とする. |
| + | #br |
| + | |
| + | *** 実行 [#rf0092bb] |
| + | (base) # jupyter notebook --allow-root --ip=0.0.0.0 |
| + | - port: 8888 |
| + | #br |
| + | |
| + | *** サブコマンド [#gaf0dfa1] |
| + | - jupyter [subcommand] を実行することと,jupyter-[subcommand] を実行することは同じ. |
| + | $ \ls jupyter-* |
| + | jupyter-bundlerextension jupyter-kernel jupyter-labhub jupyter-nbextensions_configurator jupyter-serverextension |
| + | jupyter-contrib jupyter-kernelspec jupyter-migrate jupyter-notebook jupyter-troubleshoot |
| + | jupyter-contrib-nbextension jupyter-lab jupyter-nbconvert jupyter-run jupyter-trust |
| + | jupyter-extension jupyter-labextension jupyter-nbextension jupyter-server |
| | | |
| ** JupyterLab [#b387f244] | | ** JupyterLab [#b387f244] |
| + | *** 設定 [#n53dd1dd] |
| - Jupyter Notebookの後継. WebアプリケーションによるIDE | | - Jupyter Notebookの後継. WebアプリケーションによるIDE |
| - ''jupyterhub_config.py'' で ''c.Spawner.default_url = '/lab''' とする | | - ''jupyterhub_config.py'' で ''c.Spawner.default_url = '/lab''' とする |
| | | |
- | Install | + | - Install |
- | (base) conda install -c conda-forge jupyterlab -y | + | (base) # conda install -c conda-forge jupyterlab -y |
| + | - アクセス中にクラシックノートブックにアクセスするには ''/user/{username}/tree'' にアクセス |
| + | -- /lab に戻るには ''/user/{username}/lab'' にアクセス |
| + | #br |
| + | *** Command [#ucb0d3d2] |
| + | **** Update [#gaa53fb8] |
| + | - conda update -c conda-forge jupyterlab |
| | | |
| + | - jupyter labextension update --all |
| + | -- Node.js(nodejs >=12.0.0)が必要 |
| #br | | #br |
| | | |
- | ** JupyterHub [#mb71944e] | + | **** Version [#p44ac111] |
- | - Jupyterサーバー(ユーザ認証機能つき) | + | - jupyter lab --version |
- | - https://horomary.hatenablog.com/entry/2019/11/09/181614 | + | |
| #br | | #br |
| | | |
- | *** INSTALL [#nfb5f43c] | + | ** 拡張機能 [#gc7026e3] |
- | (base) conda create -n jupyterhub python=3.8 -y | + | - https://www.hinomaruc.com/jupyter-notebook-five-extensions-recommendation/ |
- | (base) conda activate jupyterhub | + | #br |
- | (jupyterhub) conda install -c conda-forge notebook -y | + | |
- | (jupyterhub) conda install -c conda-forge jupyterlab -y | + | |
- | (jupyterhub) conda install -c conda-forge jupyterhub -y | + | |
- | (jupyterhub) conda install -c conda-forge voila -y | + | |
- | (jupyterhub) conda install jupyter_client -y | + | |
| | | |
- | (jupyterhub) git clone https://github.com/jupyterhub/nativeauthenticator.git | + | *** nbextensions [#y4176ad9] |
- | (jupyterhub) pip install -e nativeauthenticator | + | - jupyter nbextension list |
- | (jupyterhub) pip install dockerspawner | + | |
| #br | | #br |
| | | |
- | *** 設定 [#idb49705] | + | **** nbextensions_configurator [#l00f0361] |
- | - jupyterhub --generate-config を実行すると カレントディレクトリに設定ファイル ''jupyterhub_config.py'' が生成される. | + | - ブラウザのタブ上で nbextensions の切り替えができる. |
- | - 個人的には jupyterhub が /usr/local 以下にある場合は /usr/local/etc/jupyterhub 以下に置く. | + | - --user オプションを付けると個人環境にインストールされる |
| + | |
| + | (jupyterhub) # pip install jupyter_nbextensions_configurator |
| + | (jupyterhub) # jupyter nbextensions_configurator enable --user |
| #br | | #br |
| | | |
- | *** 実行 [#a826d7f6] | + | **** contrib-nbextensions [#ob2b83de] |
- | (base) conda activate jupyterhub | + | - 拡張機能 |
- | (jupyterhub) jupyterhub --no-ssl -f /usr/local/etc/jupyterhub/jupyterhub_config.py | + | - --user オプションを付けると個人環境にインストールされる |
| + | |
| + | (jupyterhub) # pip install jupyter-contrib-nbextensions |
| + | (jupyterhub) # jupyter contrib nbextension install --user |
| #br | | #br |
| | | |
- | *** 使用ポート [#me192c34] | + | **** JupyterHub でのコンテナ設定 [#a7fba7eb] |
- | - 8000 | + | - Dockerfile |
- | - 8081 | + | RUN /opt/conda/bin/conda install -c conda-forge jupyter_contrib_nbextensions -y |
- | - 8888 (Docker用?) | + | RUN /opt/conda/bin/conda install -c conda-forge jupyter_nbextensions_configurator -y |
| + | RUN /opt/conda/bin/jupyter nbextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite |
| + | RUN /opt/conda/bin/jupyter nbextension enable --sys-prefix --py jupyter_nbextensions_configurator |
| + | RUN /opt/conda/bin/jupyter serverextension enable --sys-prefix --py jupyter_nbextensions_configurator |
| #br | | #br |
| | | |
- | *** jovyan って誰? [#w4a21247] | + | **** nbgrader [#s1bead70] |
- | - Docker を使用すると,作業ディレクトリが /home/jovyan/work 固定なのだが? | + | - https://github.com/jupyter/nbgrader |
- | - c.DockerSpawner.notebook_dir 辺りをいじっても変化しない? | + | - Lab では動かんようだ. |
| #br | | #br |
| | | |
- | ** Trouble Shooting [#rf83821d] | + | *** labextensions [#sb566b8b] |
| + | - jupyter labextension list |
| + | #br |
| + | ** ショートカットキー [#c2704792] |
| + | - https://qiita.com/zawawahoge/items/baa2a5318df079c5f7e5 |
| + | #br |
| + | |
| + | ** Accessibility [#l661cb8c] |
| + | - https://jupyter-accessibility.readthedocs.io/en/latest/index.html |
| + | #br |
| + | |
| + | *** JupyterLab [#vb38bee0] |
| + | - https://github.com/Quansight-Labs/jupyter-a11y-mgmt/issues/173 (開発中) |
| + | #br |
| + | |
| + | *** Notebook [#nb19346f] |
| + | - [[Jupyter Notebook a11y toolbar>https://github.com/uclixnjupyternbaccessibility/jupyter_contrib_nbextensions/tree/master/src/jupyter_contrib_nbextensions/nbextensions/accessibility_toolbar]] 2019年で開発停止 |
| + | - [[NVDA Browser Nav add-on>https://addons.nvda-project.org/addons/browsernav.en.html#:~:text=BrowserNav%20addon%20for%20NVDA,comments%20or%20malformed%20HTML%20tables.%E2%80%9D]] (これはNVDA用のアドオン) |
| | | |
- | *** JupyterHub: PAM使用時に 再login するとPAMの認証エラーになる. [#cec1cefc] | |
- | - バグだろ. | |
- | - Resolve: jupyterhub_config.py に ''c.PAMAuthenticator.open_sessions = False'' を追加する | |
- | - see: https://github.com/jupyterhub/jupyterhub/issues/486 | |
| #br | | #br |