-
Notifications
You must be signed in to change notification settings - Fork 0
Jupyter Notebook
SaeHie Park edited this page Mar 2, 2022
·
39 revisions
Run Jupyter-notebook as a Service at http://localhost:3010/
Apache2 will proxy http://localhost:3010/ to http://domain.com/jupyter/
sudo apt-get update
sudo apt-get install python-is-python3
# or use update-alternatives command
sudo apt-get install build-essential libssl-dev libffi-dev
sudo apt-get install python3-pip python3-dev
sudo apt-get install ipython3
python -m pip install --upgrade ipykernel --user
python -m pip install --upgrade ipython --user
python -m pip install --upgrade pip --user
# for TF2.3.0, < 1.19.0
python -m pip install --upgrade numpy==1.18 --user
python -m pip install --upgrade jupyter --user
python -m pip install --upgrade pandas --user
python -m pip install --upgrade scipy --user
Creae VENV
python3 -m venv ~/venv/tf2_3_0
Enter VENV
source ~/venv/tf2_3_0/bin/activate
Install packages
python -m pip install --upgrade pip
python -m pip install --upgrade numpy==1.18
python -m pip install --upgrade jupyter
python -m pip install --upgrade pandas
python -m pip install --upgrade scipy
python -m pip install --upgrade ipykernel
jupyter notebook --generate-config
will create
$HOME/.jupyter/jupyter_notebook_config.py
$ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd; passwd()
Enter password:
Verify password:
'sha1:whatever-the-result'
c.NotebookApp.base_url = '/jupyter/'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:whatever-the-result'
c.NotebookApp.port = 3010
c.NotebookApp.allow_origin='*'
to run without apache proxy
c.NotebookApp.ip = '192.168.1.100'
python3 -m IPython kernel install --user --name "Py3_TF230"
$ which python3
/.../venv/tf2_3_0/bin/python3
vi ~/.local/share/jupyter/kernels/py3_tf230/kernel.json
edit python3
path to above python3
path
enable proxy
sudo a2enmod proxy
sudo a2enmod proxy_http
in mods-enabled/proxy.conf file
ProxyPass /jupyter http://127.0.0.1:3010/jupyter
ProxyPassReverse /jupyter http://127.0.0.1:3010/jupyter
restart apache2
sudo service apache2 restart
Create a file
/etc/systemd/system/jupyter.service
[Unit]
Description=Jupyter-Notebook
[Service]
Type=simple
PIDFile=/run/jupyter-notebook.pid
ExecStart=/home/py/.local/bin/jupyter-notebook --config=/home/pi/.jupyter/jupyter_notebook_config.py
User=pi
Group=pi
WorkingDirectory=/var/jupyter
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
Add www-data
user to pi
group in /etc/group
file
sudo systemctl reenable jupyter.service
sudo systemctl restart jupyter.service
sudo systemctl restart apache2
add
c.Session.debug = True
to config
add --debug
to /etc/systemd/system/jupyter.service
sudo systemctl daemon-reload
sudo systemctl restart jupyter.service
sudo systemctl status jupyter.service
edit custom.css
or create if not exist
vi ~/.jupyter/custom/custom.css
.CodeMirror {
font-family: Consolas;
font-size: 10pt;
}
div.output pre {
font-family: Consolas;
font-size: 10pt;
}
div.prompt {
font-family: Consolas;
font-size: 10pt;
}