見出し画像

macOS Mojave (10.14) に JupyterLab をインストールする

おおう…

$ python --version
Python 2.7.16

Python3 のインストールから始めないと…いい記事が.

スクリーンショット 2020-03-17 10.47.14

3.8.2 をダウンロード→インストール

スクリーンショット 2020-03-17 10.49.48

スクリーンショット 2020-03-17 10.50.39

スクリーンショット 2020-03-17 10.51.15

インストール後は,PATH変数が勝手にセットされている.

$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/gnuplot.app:/Applications/gnuplot.app/bin

ので basename だけで使用可能

$ python3
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>

pip も勝手についてくる.

$ pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

さて,ここで virtualenv なる記事が出てくる.

これは JupyterLab とよろしく共存できるのか?

あった.ただし,venv ではなく Virtualenv だが…

とりあえず,venv で新しい仮想環境を作成してその上に? JupyterLab をインストールするという方針でやってみる.

$ python3 -m venv ./py3env

↑少し時間を要して,プロンプトが帰ってくる.

こんな状態になっている.

$ ls py3env/
bin/		include/	lib/		pyvenv.cfg

activate

$ . ./py3env/bin/activate
(py3env) $ 
(py3env) $ python --version
Python 3.8.2
(py3env) $ pip --version
pip 19.2.3 from <HOME>/py3env/lib/python3.8/site-packages/pip (python 3.8)
(py3env) $ 

この状態で JupyterLab をインストールしてみる.

(py3env) $ pip install jupyterlab
Collecting jupyterlab
 Downloading https://files.pythonhosted.org/packages/36/d6/9e6a8a04f4fc337fbc05065d1ba4ba3460a09ee41355410bcd6d8be8841a/jupyterlab-2.0.1-py3-none-any.whl (7.7MB)
    |████████████████████████████████| 7.7MB 604kB/s 
Collecting jupyterlab-server~=1.0.0 (from jupyterlab)
 Downloading https://files.pythonhosted.org/packages/3c/ea/ae83699c4217d5668f62402445bbe4da11cc63898fbe7a57d8fed6281a04/jupyterlab_server-1.0.7-py3-none-any.whl
Collecting notebook>=4.3.1 (from jupyterlab)
 Downloading https://files.pythonhosted.org/packages/b1/f1/0a67f09ef53a342403ffa66646ee39273e0ac79ffa5de5dbe2f3e28b5bdf/notebook-6.0.3-py3-none-any.whl (9.7MB)
    |████████████████████████████████| 9.7MB 3.4MB/s 
Collecting tornado!=6.0.0,!=6.0.1,!=6.0.2 (from jupyterlab)
 Downloading https://files.pythonhosted.org/packages/95/84/119a46d494f008969bf0c775cb2c6b3579d3c4cc1bb1b41a022aa93ee242/tornado-6.0.4.tar.gz (496kB)
    |████████████████████████████████| 501kB 5.4MB/s 
Collecting jinja2>=2.10 (from jupyterlab)
 Downloading https://files.pythonhosted.org/packages/27/24/4f35961e5c669e96f6559760042a55b9bcfcdb82b9bdb3c8753dbe042e35/Jinja2-2.11.1-py2.py3-none-any.whl (126kB)
    |████████████████████████████████| 133kB 5.9MB/s 
Collecting jsonschema>=3.0.1 (from jupyterlab-server~=1.0.0->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl (56kB)
    |████████████████████████████████| 61kB 13.0MB/s 
Collecting json5 (from jupyterlab-server~=1.0.0->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/44/45/c3cc35d5c7770bd8c16aa36bb821621378af0429ac18a87052d35794cf96/json5-0.9.2-py2.py3-none-any.whl
Collecting jupyter-client>=5.3.4 (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/40/75/4c4eb43749e59db3c1c7932b50eaf8c4b8219b1b5644fe379ea796f8dbe5/jupyter_client-6.0.0-py3-none-any.whl (104kB)
    |████████████████████████████████| 112kB 6.8MB/s 
Collecting nbconvert (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/79/6c/05a569e9f703d18aacb89b7ad6075b404e8a4afde2c26b73ca77bb644b14/nbconvert-5.6.1-py2.py3-none-any.whl (455kB)
    |████████████████████████████████| 460kB 4.2MB/s 
Collecting nbformat (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/ac/eb/de575b7a64e7ab8d8c95e4c180ccc36deda3f1379186c4ee7adf6c2f1586/nbformat-5.0.4-py3-none-any.whl (169kB)
    |████████████████████████████████| 174kB 6.7MB/s 
Collecting jupyter-core>=4.6.1 (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/63/0d/df2d17cdf389cea83e2efa9a4d32f7d527ba78667e0153a8e676e957b2f7/jupyter_core-4.6.3-py2.py3-none-any.whl (83kB)
    |████████████████████████████████| 92kB 6.7MB/s 
Collecting traitlets>=4.2.1 (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl (75kB)
    |████████████████████████████████| 81kB 5.9MB/s 
Collecting prometheus-client (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/b3/23/41a5a24b502d35a4ad50a5bb7202a5e1d9a0364d0c12f56db3dbf7aca76d/prometheus_client-0.7.1.tar.gz
Collecting terminado>=0.8.1 (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/ff/96/1d9a2c23990aea8f8e0b5c3b6627d03196a73771a17a2d9860bbe9823ab6/terminado-0.8.3-py2.py3-none-any.whl
Collecting ipython-genutils (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting Send2Trash (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/49/46/c3dc27481d1cc57b9385aff41c474ceb7714f7935b1247194adae45db714/Send2Trash-1.5.0-py3-none-any.whl
Collecting ipykernel (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/d7/62/d1a5d654b7a21bd3eb99be1b59a608cc18a7a08ed88495457a87c40a0495/ipykernel-5.1.4-py3-none-any.whl (116kB)
    |████████████████████████████████| 122kB 6.0MB/s 
Collecting pyzmq>=17 (from notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/0c/d4/501fb8d4ca9e1d9a6a75ea9ccf075ef0c405611614ed370e8305276596ba/pyzmq-19.0.0-cp38-cp38-macosx_10_9_x86_64.whl (821kB)
    |████████████████████████████████| 829kB 2.7MB/s 
Collecting MarkupSafe>=0.23 (from jinja2>=2.10->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/0c/12/37f68957526d1ec0883b521934b4e1b8ff3dd8e4fab858a5bf3e487bcee9/MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl
Collecting six>=1.11.0 (from jsonschema>=3.0.1->jupyterlab-server~=1.0.0->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from jsonschema>=3.0.1->jupyterlab-server~=1.0.0->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./py3env/lib/python3.8/site-packages (from jsonschema>=3.0.1->jupyterlab-server~=1.0.0->jupyterlab) (41.2.0)
Collecting pyrsistent>=0.14.0 (from jsonschema>=3.0.1->jupyterlab-server~=1.0.0->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/90/aa/cdcf7ef88cc0f831b6f14c8c57318824c9de9913fe8de38e46a98c069a35/pyrsistent-0.15.7.tar.gz (107kB)
    |████████████████████████████████| 112kB 6.3MB/s 
Collecting python-dateutil>=2.1 (from jupyter-client>=5.3.4->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
    |████████████████████████████████| 235kB 975kB/s 
Collecting entrypoints>=0.2.2 (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/ac/c6/44694103f8c221443ee6b0041f69e2740d89a25641e62fb4f2ee568f2f9c/entrypoints-0.3-py2.py3-none-any.whl
Collecting testpath (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/1b/9e/1a170feaa54f22aeb5a5d16c9015e82234275a3c8ab630b552493f9cb8a9/testpath-0.4.4-py2.py3-none-any.whl (163kB)
    |████████████████████████████████| 174kB 593kB/s 
Collecting defusedxml (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/06/74/9b387472866358ebc08732de3da6dc48e44b0aacd2ddaa5cb85ab7e986a2/defusedxml-0.6.0-py2.py3-none-any.whl
Collecting pygments (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/2d/68/106af3ae51daf807e9cdcba6a90e518954eb8b70341cee52995540a53ead/Pygments-2.6.1-py3-none-any.whl (914kB)
    |████████████████████████████████| 921kB 991kB/s 
Collecting mistune<2,>=0.8.1 (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl
Collecting pandocfilters>=1.4.1 (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/4c/ea/236e2584af67bb6df960832731a6e5325fd4441de001767da328c33368ce/pandocfilters-1.4.2.tar.gz
Collecting bleach (from nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/6e/87/f88b0e33914420fe11fe8b820c10d045a342c2a015e79ad8309de4bba820/bleach-3.1.1-py2.py3-none-any.whl (150kB)
    |████████████████████████████████| 153kB 3.2MB/s 
Collecting decorator (from traitlets>=4.2.1->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl
Collecting ptyprocess; os_name != "nt" (from terminado>=0.8.1->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Collecting ipython>=5.0.0 (from ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/61/6f/69f1eec859ce48a86660529b166b6ea466f0f4ab98e4fc0807b835aa22c6/ipython-7.13.0-py3-none-any.whl (780kB)
    |████████████████████████████████| 788kB 1.9MB/s 
Collecting appnope; platform_system == "Darwin" (from ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/87/a9/7985e6a53402f294c8f0e8eff3151a83f1fb901fa92909bb3ff29b4d22af/appnope-0.1.0-py2.py3-none-any.whl
Collecting webencodings (from bleach->nbconvert->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl
Collecting backcall (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/84/71/c8ca4f5bb1e08401b916c68003acf0a0655df935d74d93bf3f3364b310e0/backcall-0.1.0.tar.gz
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/ab/29/d744cee89937b7e52a5c20ca237a6c77298f757965eb3eb0c653df1bfb14/prompt_toolkit-3.0.4-py3-none-any.whl (351kB)
    |████████████████████████████████| 358kB 3.7MB/s 
Collecting pickleshare (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl (59kB)
    |████████████████████████████████| 61kB 5.1MB/s 
Collecting jedi>=0.10 (from ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/01/67/333e2196b70840f411fd819407b4e98aa3150c2bd24c52154a451f912ef2/jedi-0.16.0-py2.py3-none-any.whl (1.1MB)
    |████████████████████████████████| 1.1MB 4.7MB/s 
Collecting wcwidth (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/58/b4/4850a0ccc6f567cc0ebe7060d20ffd4258b8210efadc259da62dc6ed9c65/wcwidth-0.1.8-py2.py3-none-any.whl
Collecting parso>=0.5.2 (from jedi>=0.10->ipython>=5.0.0->ipykernel->notebook>=4.3.1->jupyterlab)
 Downloading https://files.pythonhosted.org/packages/da/15/888f80e429a971d3838124adde705d7b07650aa3a59f4db07d61f653b8cd/parso-0.6.2-py2.py3-none-any.whl (97kB)
    |████████████████████████████████| 102kB 6.5MB/s 
Installing collected packages: six, attrs, pyrsistent, jsonschema, tornado, python-dateutil, decorator, ipython-genutils, traitlets, jupyter-core, pyzmq, jupyter-client, nbformat, entrypoints, MarkupSafe, jinja2, testpath, defusedxml, pygments, mistune, pandocfilters, webencodings, bleach, nbconvert, prometheus-client, ptyprocess, terminado, Send2Trash, backcall, wcwidth, prompt-toolkit, appnope, pickleshare, pexpect, parso, jedi, ipython, ipykernel, notebook, json5, jupyterlab-server, jupyterlab
 Running setup.py install for pyrsistent ... done
 Running setup.py install for tornado ... done
 Running setup.py install for pandocfilters ... done
 Running setup.py install for prometheus-client ... done
 Running setup.py install for backcall ... done
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 appnope-0.1.0 attrs-19.3.0 backcall-0.1.0 bleach-3.1.1 decorator-4.4.2 defusedxml-0.6.0 entrypoints-0.3 ipykernel-5.1.4 ipython-7.13.0 ipython-genutils-0.2.0 jedi-0.16.0 jinja2-2.11.1 json5-0.9.2 jsonschema-3.2.0 jupyter-client-6.0.0 jupyter-core-4.6.3 jupyterlab-2.0.1 jupyterlab-server-1.0.7 mistune-0.8.4 nbconvert-5.6.1 nbformat-5.0.4 notebook-6.0.3 pandocfilters-1.4.2 parso-0.6.2 pexpect-4.8.0 pickleshare-0.7.5 prometheus-client-0.7.1 prompt-toolkit-3.0.4 ptyprocess-0.6.0 pygments-2.6.1 pyrsistent-0.15.7 python-dateutil-2.8.1 pyzmq-19.0.0 six-1.14.0 terminado-0.8.3 testpath-0.4.4 tornado-6.0.4 traitlets-4.3.3 wcwidth-0.1.8 webencodings-0.5.1
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(py3env) $ 

起動してみる.

(py3env) $ jupyter lab
[I 11:16:39.285 LabApp] Writing notebook server cookie secret to /Users/snakai/Library/Jupyter/runtime/notebook_cookie_secret
[I 11:16:40.310 LabApp] JupyterLab extension loaded from /Users/snakai/py3env/lib/python3.8/site-packages/jupyterlab
[I 11:16:40.310 LabApp] JupyterLab application directory is /Users/snakai/py3env/share/jupyter/lab
[I 11:16:40.314 LabApp] Serving notebooks from local directory: /Users/snakai
[I 11:16:40.314 LabApp] The Jupyter Notebook is running at:
[I 11:16:40.314 LabApp] http://localhost:8888/?token=481ee4e270c8f54d722ed5a18fa6bc59e0fe8e3e0bce2642
[I 11:16:40.314 LabApp]  or http://127.0.0.1:8888/?token=481ee4e270c8f54d722ed5a18fa6bc59e0fe8e3e0bce2642
[I 11:16:40.314 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:16:40.331 LabApp] 
   
   To access the notebook, open this file in a browser:
       file:///Users/snakai/Library/Jupyter/runtime/nbserver-2131-open.html
   Or copy and paste one of these URLs:
       http://localhost:8888/?token=481ee4e270c8f54d722ed5a18fa6bc59e0fe8e3e0bce2642
    or http://127.0.0.1:8888/?token=481ee4e270c8f54d722ed5a18fa6bc59e0fe8e3e0bce2642
[I 11:16:45.561 LabApp] Build is up to date

起動した!

スクリーンショット 2020-03-17 11.17.15

Hello World やってみた

スクリーンショット 2020-03-17 11.22.21


この記事が気に入ったらサポートをしてみませんか?