|
|
# Installation von »Jupyter Lab«
|
|
# Installation von »Jupyter Lab«
|
|
|
|
|
|
|
|
»Jupyter Lab« ist eine web-basierte interaktive Umgebung zur Erzeugung von Jupyter-Notebook-Dokumenten (oft Python-Programme mit zugehöriger
|
|
»Jupyter Lab« ist eine web-basierte interaktive Umgebung zur Erzeugung von Jupyter-Notebook-Dokumenten (oft Python-Programme mit zugehöriger
|
|
|
Dokumentation).
|
|
Dokumentation).
|
|
|
|
|
|
|
|
Nachfolgend werden Hinweise zur Installation unter openSUSE 15.5 gegeben. Sie gelten sinngemäß auch für andere systemd-basierte Linux-Distributionen.
|
|
Nachfolgend werden Hinweise zur Installation unter openSUSE 15.5 gegeben. Sie gelten sinngemäß auch für andere systemd-basierte Linux-Distributionen.
|
|
|
|
|
|
|
|
## Installation der nötiger System-Pakete
|
|
## Installation der nötigen System-Pakete
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
zypper in --recommends apache2 inkscape python311-base pandoc
|
|
zypper in --recommends apache2 inkscape python311-base pandoc
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Anmerkung: Mit Pythonversionen <= 3.6 gab es Probleme.
|
|
Anmerkung: Mit Pythonversionen <= 3.6 gab es Probleme.
|
|
|
|
|
|
|
|
## Apache-Server als Proxy einrichten.
|
|
## Apache-Server als Proxy einrichten.
|
|
|
|
|
|
|
|
Im Verzeichnis `/etc/apache2/vhosts.d` ist die Datei `jupyterlab.conf` mit folgendem Inhalt zu erstellen:
|
|
Im Verzeichnis `/etc/apache2/vhosts.d` ist die Datei `jupyterlab.conf` mit folgendem Inhalt zu erstellen:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
Listen 82
|
|
Listen 82
|
|
|
|
|
|
|
|
<VirtualHost *:82>
|
|
<VirtualHost *:82>
|
|
|
Header edit Origin a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
Header edit Origin a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
|
RequestHeader edit Origin a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
RequestHeader edit Origin a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
|
|
|
|
|
|
Header edit Referer a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
Header edit Referer a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
|
RequestHeader edit Referer a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
RequestHeader edit Referer a73435.berlin.ptb.de:82 127.0.0.1:8888
|
|
|
|
|
|
|
|
<Location />
|
|
<Location />
|
|
|
ProxyPass http://127.0.0.1:8888/
|
|
ProxyPass http://127.0.0.1:8888/
|
|
|
ProxyPassReverse http://127.0.0.1:8888/
|
|
ProxyPassReverse http://127.0.0.1:8888/
|
|
|
</Location>
|
|
</Location>
|
|
|
|
|
|
|
|
<Location /api/kernels/>
|
|
<Location /api/kernels/>
|
|
|
ProxyPass ws://127.0.0.1:8888/api/kernels/
|
|
ProxyPass ws://127.0.0.1:8888/api/kernels/
|
|
|
ProxyPassReverse ws://127.0.0.1:8888/api/kernels/
|
|
ProxyPassReverse ws://127.0.0.1:8888/api/kernels/
|
|
|
</Location>
|
|
</Location>
|
|
|
</VirtualHost>
|
|
</VirtualHost>
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Anmerkung: Statt des Ports 82 kann auch ein anderer gewählt werden.
|
|
Anmerkung: Statt des Ports 82 kann auch ein anderer gewählt werden.
|
|
|
|
|
|
|
|
Desweiteren sind einige Apache-Module zu aktivieren
|
|
Desweiteren sind einige Apache-Module zu aktivieren
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo a2enmod mod_proxy_wstunnel proxy proxy_http headers proxy_wstunnel
|
|
sudo a2enmod mod_proxy_wstunnel proxy proxy_http headers proxy_wstunnel
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
und der Apache-Prozess ist neu zu starten:
|
|
und der Apache-Prozess ist neu zu starten:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo systemctl restart apache2.service
|
|
sudo systemctl restart apache2.service
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Dies bewirkt, dass künftig alle Anfragen an `http://a73435.berlin.ptb.de:82/` nach `http://127.0.0.1:8888/` umgeleitet werden.
|
|
Dies bewirkt, dass künftig alle Anfragen an `http://a73435.berlin.ptb.de:82/` nach `http://127.0.0.1:8888/` umgeleitet werden.
|
|
|
|
|
|
|
|
## Installation der Komponenten von »Jupyter Lab«
|
|
## Installation der Komponenten von »Jupyter Lab«
|
|
|
|
|
|
|
|
### Anlegen einer virtuellen Python-Umgebung
|
|
### Anlegen einer virtuellen Python-Umgebung
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
cd /usr/local/share/
|
|
cd /usr/local/share/
|
|
|
/usr/bin/python3.11 -m venv JupyterLab
|
|
/usr/bin/python3.11 -m venv JupyterLab
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Installation der nötigen Python-Bibliotheken
|
|
### Installation der nötigen Python-Bibliotheken
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
cd JupyterLab
|
|
cd JupyterLab
|
|
|
source ./bin/activate
|
|
source ./bin/activate
|
|
|
python3 -m pip install --upgrade pip
|
|
python3 -m pip install --upgrade pip
|
|
|
pip3 install jupyterlab nbconvert
|
|
pip3 install jupyterlab nbconvert
|
|
|
# Zusätzliche Nutzer-Bibliotheken:
|
|
# Zusätzliche Nutzer-Bibliotheken:
|
|
|
pip3 install matplotlib statistics datetime numpy sympy pandas couchdb
|
|
pip3 install matplotlib statistics datetime numpy sympy pandas couchdb
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Erzeugen eines Passwortes
|
|
### Erzeugen eines Passwortes
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
JUPYTER_CONFIG_DIR=$PWD jupyter server password
|
|
JUPYTER_CONFIG_DIR=$PWD jupyter server password
|
|
|
Enter password: ...
|
|
Enter password: ...
|
|
|
Verify password: ...
|
|
Verify password: ...
|
|
|
...
|
|
...
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Anmerkung: Es wird der Hash-Code des Passwortes in die Datei `jupyter_server_config.json` im aktuellen Verzeichnis geschrieben. Um tatsächlich die gewohnte Passwortabfrage zu erhalten, muss der Inhalt der eben erzeugten Datei
|
|
Anmerkung: Es wird der Hash-Code des Passwortes in die Datei `jupyter_server_config.json` im aktuellen Verzeichnis geschrieben. Um tatsächlich die gewohnte Passwortabfrage zu erhalten, muss der Inhalt der eben erzeugten Datei
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
{
|
|
{
|
|
|
"IdentityProvider": {
|
|
"IdentityProvider": {
|
|
|
"hashed_password": "argon2:$argon2id$v=19$m=10240,t=10,p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
"hashed_password": "argon2:$argon2id$v=19$m=10240,t=10,p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
zu
|
|
zu
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
{
|
|
{
|
|
|
"ServerApp": {
|
|
"ServerApp": {
|
|
|
"password": "argon2:$argon2id$v=19$m=10240,t=10,p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
"password": "argon2:$argon2id$v=19$m=10240,t=10,p=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
geändert werden.
|
|
geändert werden.
|
|
|
|
|
|
|
|
### Erzeugen einer Systemd-Service-Datei
|
|
### Erzeugen einer Systemd-Service-Datei
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
deactivate
|
|
deactivate
|
|
|
|
|
|
|
|
cat <<EOF > JupyterLab.service
|
|
cat <<EOF > JupyterLab.service
|
|
|
[Unit]
|
|
[Unit]
|
|
|
Description=JupyterLab Service
|
|
Description=JupyterLab Service
|
|
|
|
|
|
|
|
[Service]
|
|
[Service]
|
|
|
Type=simple
|
|
Type=simple
|
|
|
WorkingDirectory=/usr/local/share/JupyterLab
|
|
WorkingDirectory=/usr/local/share/JupyterLab
|
|
|
EnvironmentFile=-/etc/environment
|
|
EnvironmentFile=-/etc/environment
|
|
|
ExecStart=/bin/bash -lc 'source ./bin/activate ; \\
|
|
ExecStart=/bin/bash -lc 'source ./bin/activate ; \\
|
|
|
jupyter lab --notebook-dir=/home/ipynb/notebooks --no-browser \\
|
|
jupyter lab --notebook-dir=/home/ipynb/notebooks --no-browser \\
|
|
|
--config=./jupyter_server_config.json'
|
|
--config=./jupyter_server_config.json'
|
|
|
User=ipynb
|
|
User=ipynb
|
|
|
Group=ipynb
|
|
Group=ipynb
|
|
|
PIDFile=/run/jupyterlab.pid
|
|
PIDFile=/run/jupyterlab.pid
|
|
|
Restart=on-failure
|
|
Restart=on-failure
|
|
|
RestartSec=60s
|
|
RestartSec=60s
|
|
|
|
|
|
|
|
[Install]
|
|
[Install]
|
|
|
WantedBy=multi-user.target
|
|
WantedBy=multi-user.target
|
|
|
|
|
|
|
|
EOF
|
|
EOF
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Start des Systemd-Services
|
|
### Start des Systemd-Services
|
|
|
|
|
|
|
|
(Unter root-Account ausführen.)
|
|
(Unter root-Account ausführen.)
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
systemctl link $PWD/JupyterLab.service
|
|
systemctl link $PWD/JupyterLab.service
|
|
|
systemctl daemon-reload
|
|
systemctl daemon-reload
|
|
|
systemctl enable JupyterLab.service
|
|
systemctl enable JupyterLab.service
|
|
|
systemctl start JupyterLab.service
|
|
systemctl start JupyterLab.service
|
|
|
systemctl status JupyterLab.service
|
|
systemctl status JupyterLab.service
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Spätere Installation weiterer Python-Bibliotheken
|
|
## Spätere Installation weiterer Python-Bibliotheken
|
|
|
|
|
|
|
|
### Neuinstallation
|
|
### Neuinstallation
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
ssh root@a73435
|
|
ssh root@a73435
|
|
|
...
|
|
...
|
|
|
cd /usr/local/share/JupyterLab
|
|
cd /usr/local/share/JupyterLab
|
|
|
source ./bin/activate
|
|
source ./bin/activate
|
|
|
pip3 install xyz uvw abc
|
|
pip3 install xyz uvw abc
|
|
|
deactivate
|
|
deactivate
|
|
|
#
|
|
#
|
|
|
chown -R ipynb.ipynb /usr/local/share/JupyterLab
|
|
chown -R ipynb.ipynb /usr/local/share/JupyterLab
|
|
|
systemctl restart JupyterLab.service
|
|
systemctl restart JupyterLab.service
|
|
|
#
|
|
#
|
|
|
exit
|
|
exit
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Update eines bereits installierten Paketes
|
|
### Update eines bereits installierten Paketes
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
ssh root@a73435
|
|
ssh root@a73435
|
|
|
...
|
|
...
|
|
|
cd /usr/local/share/JupyterLab
|
|
cd /usr/local/share/JupyterLab
|
|
|
source ./bin/activate
|
|
source ./bin/activate
|
|
|
pip3 install <package_name> --upgrade
|
|
pip3 install <package_name> --upgrade
|
|
|
deactivate
|
|
deactivate
|
|
|
#
|
|
#
|
|
|
chown -R ipynb.ipynb /usr/local/share/JupyterLab
|
|
chown -R ipynb.ipynb /usr/local/share/JupyterLab
|
|
|
systemctl restart JupyterLab.service
|
|
systemctl restart JupyterLab.service
|
|
|
#
|
|
#
|
|
|
exit
|
|
exit
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Update sämtlicher installierter Pakete einschließlich »Jupyter Lab« selbst
|
|
### Update sämtlicher installierter Pakete einschließlich »Jupyter Lab« selbst
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
ssh root@a73435
|
|
ssh root@a73435
|
|
|
...
|
|
...
|
|
|
cd /usr/local/share/JupyterLab
|
|
cd /usr/local/share/JupyterLab
|
|
|
source ./bin/activate
|
|
source ./bin/activate
|
|
|
for i in $(pip3 list -o | awk 'NR > 2 {print $1}'); do pip3 install --upgrade $i; done
|
|
for i in $(pip3 list -o | awk 'NR > 2 {print $1}'); do pip3 install --upgrade $i; done
|
|
|
deactivate
|
|
deactivate
|
|
|
#
|
|
#
|
|
|
chown -R ipynb.ipynb /usr/local/share/JupyterLab
|
|
chown -R ipynb.ipynb /usr/local/share/JupyterLab
|
|
|
systemctl restart JupyterLab.service
|
|
systemctl restart JupyterLab.service
|
|
|
#
|
|
#
|
|
|
exit
|
|
exit
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|