はじめに
インストールしているはずのjupyter labを立ち上げようと、
ターミナルでjupyter labコマンドを実行したら
zsh:`jupyter-lab` command not found
と表示されてしまったときの備忘録です。備忘録なので物語は進みません…。
動作環境
・MacBook Air (Retina, 13-inch, 2020)
・Big Sur11.4
・Python 3.8.9
・Anacondaは使用していません
結論
jupyter labをアンインストール -> 再インストールする。
その際にWARNINGと闘うのでPATHを通してWARNINGに打ち勝つ。
実行したこと
(1)「jupyter lab存在しないよ」って言われたので再インストールしてみる
(中略)
ERROR:Command errored out with exit status 1:
command:/Library/Developer/CommandLineTools/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wh/d805s1757px5l7pw7g0w8q5r0000gn/T/pip-install-1f147c0q/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/wh/d805s1757px5l7pw7g0w8q5r0000gn/T/pip-install-1f147c0q/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/wh/d805s1757px5l7pw7g0w8q5r0000gn/T/pip-pip-egg-info-6mnl0uv6
cwd: /private/var/folders/wh/d805s1757px5l7pw7g0w8q5r0000gn/T/pip-install-1f147c0q/matplotlib/
(中略)
(2)pipをアップデートする
python3 -m pip install --upgrade pip
(3)(1)で「jupyter lab入ってるで」と言われたのでアンインストールを試みる
pip3 install pip-autoremove
pip-autoremove jupyter -y
(4)再度jupyter labをインストールすると、
以下のようにWARNINGがダダダっと羅列され、その量に圧倒してしまう
(中略)
WARNING: The scripts jlpm, jupyter-lab, jupyter-labextension and jupyter-labhub are installed in '/Library/Python/3.8/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts jlpm, jupyter-lab, jupyter-labextension and jupyter-labhub are installed in '/Users/watashi/Library/Python/3.8/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script jupyter-server is installed in '/Users/watashi/Library/Python/3.8/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
(中略)
目がしぱしぱしながらも読むと「PATH通して〜」と言われていることが分かりました。
(5)PATHを通しに行きます
vim ~/.zshrc
~~~
export PATH=$PATH:/Users/watashi/Library/Python/3.8/bin ※追加
~~~
:wq
(6)反映させます
source ~/.zshrc
(7)ターミナルを一旦終了、再び起動し、
jupyter labコマンドを実行するとjupyter labが起動しました。
jupyter lab
あとがき
これまで保存していたファイルも無事に残っていました。
少し前までTwitterAPIを叩けていたので原因も分からず…。
ここまでお読みいただきありがとうございました。
参考