導入までは以下の記事ほぼそのままです。※pip 使わず conda 使ってるところだけ違う。元記事の方はうんこ漏らしてません。
インストール
インストーラは一ディレクトリ作成
$ mkdir tmp $ cd tmp
以下のページより Linux 向けインストーラのパスをコピー
これ
ダウンロード
# URLに上記インストーラのパスを指定 $ wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh
インストーラ実行
$ bash Anaconda3-2022.10-Linux-x86_64.sh Welcome to Anaconda3 2022.10 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>> ##### ここにライセンス文が表示される #####
ライセンスに同意
Do you accept the license terms? [yes|no] [no] >>> yes
ロケーション選択
Anaconda3 will now be installed into this location: /home/talkeyboid/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/talkeyboid/anaconda3] >>>
conda init するか
Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no] [no] >>> yes
/tmp
を削除
$ cd .. $ rm -rf tmp/
パス設定
パス設定し反映
$ echo "export PATH=~/anaconda3/bin:\$PATH" >> ~/.bash_profile $ source ~/.bash_profile
バージョン確認
$ conda -V conda 22.9.0
conda init
元記事では conda init bash
を実行していますが、インストーラの指示に従い、conda init? >>> yes
としたため対応不要です。
念のため確認
$ cat ~/.bashrc ... # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/talkeyboid/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/talkeyboid/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/talkeyboid/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/talkeyboid/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<<
設定を反映
$ source ~/.bashrc
するとこんな感じでプロンプトに conda 環境名がつく
talkeyboid@talkeyboidsrfc:~$ source ~/.bashrc (base) talkeyboid@talkeyboidsrfc:~$
conda 環境構築
一旦適当に作る。
$ conda create -n test python=3.9 $ conda info -e # conda environments: # base * /home/talkeyboid/anaconda3 test /home/talkeyboid/anaconda3/envs/test $ conda activate test
Jupyter導入
# 元サイトは pip で入れているが私の環境では conda でインストールする $ conda install jupyterlab $ jupyter kernelspec list Available kernels: python3 /home/talkeyboid/anaconda3/envs/test/share/jupyter/kernels/python3
Jupyter起動
$ jupyter lab --NotebookApp.token='' [W 2023-03-06 21:54:36.226 LabApp] 'token' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release. [I 2023-03-06 21:54:36.232 ServerApp] jupyterlab | extension was successfully linked. [I 2023-03-06 21:54:36.238 ServerApp] nbclassic | extension was successfully linked. [I 2023-03-06 21:54:36.241 ServerApp] Writing Jupyter server cookie secret to /home/talkeyboid/.local/share/jupyter/runtime/jupyter_cookie_secret [I 2023-03-06 21:54:36.458 ServerApp] notebook_shim | extension was successfully linked. [W 2023-03-06 21:54:36.475 ServerApp] All authentication is disabled. Anyone who can connect to this server will be able to run code. [I 2023-03-06 21:54:36.478 ServerApp] notebook_shim | extension was successfully loaded. [I 2023-03-06 21:54:36.480 LabApp] JupyterLab extension loaded from /home/talkeyboid/anaconda3/envs/test/lib/python3.9/site-packages/jupyterlab [I 2023-03-06 21:54:36.480 LabApp] JupyterLab application directory is /home/talkeyboid/anaconda3/envs/test/share/jupyter/lab [I 2023-03-06 21:54:36.484 ServerApp] jupyterlab | extension was successfully loaded. _ _ _ _ | | | |_ __ __| |__ _| |_ ___ | |_| | '_ \/ _` / _` | _/ -_) \___/| .__/\__,_\__,_|\__\___| |_| Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions. https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html Please note that updating to Notebook 7 might break some of your extensions. [I 2023-03-06 21:54:36.491 ServerApp] nbclassic | extension was successfully loaded. [I 2023-03-06 21:54:36.492 ServerApp] Serving notebooks from local directory: /home/talkeyboid [I 2023-03-06 21:54:36.492 ServerApp] Jupyter Server 1.23.4 is running at: [I 2023-03-06 21:54:36.492 ServerApp] http://localhost:8888/lab [I 2023-03-06 21:54:36.492 ServerApp] or http://127.0.0.1:8888/lab [I 2023-03-06 21:54:36.492 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
が、http://localhost:8888/lab
もしくは http://localhost:8888
でつながらない。
こんなかんじで pending
。
設定ファイル周りで何かよくないのかといろいろとググっていたところ、いつのまにか起動してました。あまりに時間がかかってしまっていたので、ググってる途中でちょっとうんこ漏れた。
何回もアクセスしていたからか、起動ログ的には GET がめちゃくちゃ走ってる。22:04~22:13って時間かかりすぎでないか???使い物にならん。
[I 2023-03-06 22:04:20.021 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [I 2023-03-06 22:13:09.644 ServerApp] 302 GET / (127.0.0.1) 31.37ms [I 2023-03-06 22:13:09.645 ServerApp] 302 GET / (127.0.0.1) 31.54ms [I 2023-03-06 22:13:09.645 ServerApp] 302 GET / (127.0.0.1) 31.49ms [I 2023-03-06 22:13:09.645 ServerApp] 302 GET / (127.0.0.1) 31.28ms [I 2023-03-06 22:13:09.646 ServerApp] 302 GET / (127.0.0.1) 31.20ms [I 2023-03-06 22:13:09.646 ServerApp] 302 GET / (127.0.0.1) 31.16ms [I 2023-03-06 22:13:09.651 ServerApp] 302 GET / (127.0.0.1) 35.09ms [I 2023-03-06 22:13:09.652 ServerApp] 302 GET / (127.0.0.1) 35.22ms [I 2023-03-06 22:13:09.652 ServerApp] 302 GET / (127.0.0.1) 35.40ms [I 2023-03-06 22:13:09.664 ServerApp] 302 GET / (127.0.0.1) 45.87ms [I 2023-03-06 22:13:09.677 ServerApp] 302 GET / (127.0.0.1) 55.90ms
ノートブック動きました。
立ち上がるまでにめちゃ時間かかるのとても前時代的PC感あるのでなんとかしたいですね。