티스토리 뷰

OS/Orange PI

Orange Pi 5 : Jupyter Notebook 설치

파란크리스마스 2023. 2. 2. 00:12
728x90

출처

Python3 설치

orangepi@orangepi5:~$ sudo apt install python3 python3-pip
orangepi@orangepi5:~$ python3 --version
Python 3.10.6
orangepi@orangepi5:~$ pip3 --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

Jupyter Notebook 설치

orangepi@orangepi5:~$ sudo -H pip3 install jupyter
orangepi@orangepi5:~$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.9.0
ipykernel        : 6.20.2
ipywidgets       : 8.0.4
jupyter_client   : 8.0.2
jupyter_core     : 5.2.0
jupyter_server   : 2.2.0
jupyterlab       : not installed
nbclient         : 0.7.2
nbconvert        : 7.2.9
nbformat         : 5.7.3
notebook         : 6.5.2
qtconsole        : 5.4.0
traitlets        : 5.9.0

Jupyter Notebook 환경 설정

orangepi@orangepi5:~$ jupyter notebook --generate-config
Writing default config to: /home/orangepi/.jupyter/jupyter_notebook_config.py

암호 생성

orangepi@orangepi5:~$ cd .jupyter/
orangepi@orangepi5:~/.jupyter$ ls
jupyter_notebook_config.py  migrated
orangepi@orangepi5:~/.jupyter$ python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password: 
Verify password: 
'argon2:$argon2id$v=19$m=10240,t=10,p=8$Vl7CWpGCIIvCCE3xRc8fkw$IRE5DSzO6WDw/REgmYO7u08PFqHvGxQ0t9OA1jQ4jks'
>>> quit()

jupyter_notebook_config.py 편집

orangepi@orangepi5:~/.jupyter$ vi ~/.jupyter/jupyter_notebook_config.py
jupyter_notebook_config.py 파일
## Set the Access-Control-Allow-Origin header
#  
#          Use '*' to allow any origin to access your server.
#  
#          Takes precedence over allow_origin_pat.
#  Default: ''
c.NotebookApp.allow_origin = '*'

## The IP address the notebook server will listen on.
#  Default: 'localhost'
c.NotebookApp.ip = '0.0.0.0'

## Hashed password to use for web authentication.
#  
#                        To generate, type in a python/IPython shell:
#  
#                          from notebook.auth import passwd; passwd()
#  
#                        The string should be of the form type:salt:hashed-
#  password.
#  Default: ''
c.NotebookApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$Vl7CWpGCIIvCCE3xRc8fkw$IRE5DSzO6WDw/REgmYO7u08PFqHvGxQ0t9OA1jQ4jks'

작업 디렉토리 생성

orangepi@orangepi5:~$ cd ~
orangepi@orangepi5:~$ mkdir notebookDir

jupyter-notebook 실행 경로 확인

orangepi@orangepi5:~$ whereis jupyter-notebook
jupyter-notebook: /usr/local/bin/jupyter-notebook/pre>

서비스 등록

서비스(jupyter.service) 파일 생성

orangepi@orangepi5:/etc/systemd/system$ sudo vi /etc/systemd/system/jupyter.service
jupyter.service 파일
[Unit]
Description=Jupyter Notebook Server

[Service]
Type=test
PIDFile=/run/jupyter.pid
User=orangepi
ExecStart=/usr/local/bin/jupyter-notebook
WorkingDirectory=/home/orangepi/notebookDir

[Install]
WantedBy=multi-user.target

서비스 등록

orangepi@orangepi5:/etc/systemd/system$ sudo systemctl enable jupyter.service

서비스 시작

orangepi@orangepi5:/etc/systemd/system$ sudo systemctl start jupyter

서비스 실행 상태 확인

orangepi@orangepi5:/etc/systemd/system$ sudo systemctl status jupyter
● jupyter.service - Jupyter Notebook Server
     Loaded: loaded (/etc/systemd/system/jupyter.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-02-02 22:36:43 CST; 2s ago
   Main PID: 4537 (jupyter-noteboo)
      Tasks: 1 (limit: 18821)
     Memory: 67.2M
        CPU: 1.166s
     CGroup: /system.slice/jupyter.service
             └─4537 /usr/bin/python3 /usr/local/bin/jupyter-notebook
 
Feb 02 22:36:43 orangepi5 systemd[1]: Started Jupyter Notebook Server.
Feb 02 22:36:45 orangepi5 jupyter-notebook[4537]: [I 22:36:45.912 NotebookApp] Serving notebooks from local directory: /home/orangepi/notebo>
Feb 02 22:36:45 orangepi5 jupyter-notebook[4537]: [I 22:36:45.912 NotebookApp] Jupyter Notebook 6.5.2 is running at:
Feb 02 22:36:45 orangepi5 jupyter-notebook[4537]: [I 22:36:45.912 NotebookApp] http://orangepi5:8888/
Feb 02 22:36:45 orangepi5 jupyter-notebook[4537]: [I 22:36:45.912 NotebookApp] Use Control-C to stop this server and shut down all kernels (>
Feb 02 22:36:45 orangepi5 jupyter-notebook[4537]: [W 22:36:45.917 NotebookApp] No web browser found: could not locate runnable browser.
lines 1-16/16 (END)

Jupyter Notebook 실행

댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함