Jupyter

De BrapciWiki
Ir para navegação Ir para pesquisar

[[1]] O Jupyter Hub da Plataforma de Ciência de Dados aplicada à Saúde (PCDaS), disponível para usiários de projetos parceiros, roda kernels em Python e R conectados ao dados já indexados em Elaticserach.

Jupyter HUB

curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo -E python3 - --admin \<admin-user-name>

Checar Versão

jupyter --version

Instalação Jupyter Hub

GutHub JupyerHub

Pré-requesito

apt install npm
apt install python3-pip

Instalando Jupyter

Using pip JupyterHub can be installed with pip, and the proxy with npm:

npm install -g configurable-http-proxy
python3 -m pip install jupyterhub    

If you plan to run notebook servers locally, you will need to install the Jupyter notebook package:

python3 -m pip install --upgrade notebook

Instalando Jupyter no Windows

pip3 install jupyterlab

Iniciando o JupyterHub

jupyterhub

Executando no Windows

jupyter-lab

Arquivo de configuração

c.JupyterHub.data_files_path = '/usr/local/share/jupyterhub'


Start the Hub To start the Hub on a specific url and port 10.0.1.2:443 with https:

jupyterhub --ip 10.0.1.2 --port 443 --ssl-key my_ssl.key --ssl-cert my_ssl.cert

Kernal

Identificar os Kernels instalados

jupyter kernelspec list

Configurações no Ubuntu

Gerar arquivo de configurações

jupyter-lab --generate-config
pico /root/.jupyter/jupyter_notebook_config.py

Criando um serviço

Crie um arquivo jupyter.service

pico /etc/systemd/system/jupyter.service
Lembre-se de alterar WorkingDirectory

Com o conteúdo,

[Unit]
Description=Jupyter Hub
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/opt/tljh/hub/bin/jupyterhub --config=/root/.jupyter/jupyter_notebook_config.py
WorkingDirectory=/data/jupyter
User=root
Group=root
Restart=always
RestartSec=10
#KillMode=mixed
[Install]
WantedBy=multi-user.target

R with JupyterHub

https://jupyter.org/try


GitHub R Acesse o R

R

Instale os pacote

install.packages('IRkernel')
IRkernel::installspec()  # to register the kernel in the current R installation

Composer

apt-get install composer

Jupyter com o R

R
install.packages('IRkernel')
IRkernel::installspec(user = FALSE)

Source: [[2]]

Jupyter with PHP

Necessário instalar o Composer e o php-zmg

apt-get install composer

Ativamdno modulo ZMQ

apt-get install php-zmq 
wget https://litipk.github.io/Jupyter-PHP-Installer/dist/jupyter-php-installer.phar
php ./jupyter-php-installer.phar install.

[Jupyter-PHP's Installer]

Jupyter with Python

pip install pyDataverse

Outros pacotes

GitHub jupyter/nbgraber


==Jupyter FABICO--

[http://143.54.210.171/]
user: adminjupyter
senha: jpthb

Kernel

Lista os Kernels

jupyter kernelspec list

Apache2

<IfModule mod_ssl.c>
<VirtualHost *:443>
   ServerAdmin renefgj@gmail.com
   ErrorLog ${APACHE_LOG_DIR}.error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
 
   SSLProxyEngine On
   SSLProxyVerify none
   SSLProxyCheckPeerCN off
   SSLProxyCheckPeerName off
   SSLProxyCheckPeerExpire off

   ProxyPreserveHost On
   ProxyRequests Off

   LogLevel debug
   ProxyPass / http://143.54.112.219:100/
   ProxyPassReverse / http://143.54.112.219:100/

   Header edit Origin jupyther.brapci.inf.br 143.54.112.219:100
   RequestHeader edit Origin jupyther.brapci.inf.br 143.54.112.219:100
   Header edit Referer jupyther.brapci.inf.br 143.54.112.219:100
   RequestHeader edit Referer jupyther.brapci.inf.br 143.54.112.219:100

   <Location ~ "/(user/[^/]*)/(api/kernels/[^/]+/channels|terminals/websocket)/?">
       ProxyPass ws://143.54.112.219:100
       ProxyPassReverse ws://143.54.112.219:100
   </Location>

   ServerName jupyter.brapci.inf.br
   Include /etc/letsencrypt/options-ssl-apache.conf
   SSLCertificateFile /etc/letsencrypt/live/brapci.inf.br-0001/fullchain.pem
   SSLCertificateKeyFile /etc/letsencrypt/live/brapci.inf.br-0001/privkey.pem
</VirtualHost>
</IfModule>