Jupyter Notebook

Como instalar o Jupyter Notebook?

Usando o pip3?

pip3 install jupyter

Usando o conda?

# usando o repositório padrão:conda install jupyter# ou se quiser usar o conda-forge:conda install --channel conda-forge jupyter

Como iniciar o Jupyter Notebook?

Iniciando por linha de comando

jupyter notebook

Iniciando via script bash pelo conda

#!/bin/bashsource ~/miniconda3/bin/activate ~/miniconda3/envs/my-env# também pode ser o comando abaixo, entretanto pode ser que dê erro:# conda activate ~/miniconda3/envs/my-envecho "current conda env is ${CONDA_DEFAULT_ENV}"jupyter notebook

Caso aconteça algum erro, você tambem pode tentar o seguinte:

#!/bin/bash# Fazendo o bash encontrar o binário do condaeval "$(/home/tiago/miniconda3/bin/conda shell.bash hook)" &&# Indo até a pasta em que o Jupyter ficará abertocd ~/Documents/BusAnalysis/ &&# Ativando o ambiente conda desejadoconda activate ~/Documents/BusAnalysis/urbs-bus-analysis/geopandas-env/ &&# Iniciando o Jupyter Notebookjupyter notebook --ip 0.0.0.0 --port 8888# Pausando o bash (para debug caso algum erro aconteça)$SHELL

Iniciando via atalho no Desktop Linux

Crie um arquivo bash com o seguinte (troque as pastas com os endereços do seu computador):

#!/bin/bash# Fazendo o bash encontrar o binário do condaeval "$(/home/tiago/miniconda3/bin/conda shell.bash hook)" &&# Indo até a pasta em que o Jupyter ficará abertocd ~/Documents/BusAnalysis/ &&# Ativando o ambiente conda desejadoconda activate ~/Documents/BusAnalysis/urbs-bus-analysis/geopandas-env/ &&# Iniciando o Jupyter Notebookjupyter notebook --ip 0.0.0.0 --port 8888# Pausando o bash (para debug caso algum erro aconteça)$SHELL

E crie o arquivo de atalho:

[Desktop Entry]Type=ApplicationExec=/bin/bash ~/Documents/BusAnalysis/urbs-bus-analysis/start-jupyter-notebook.bashName=Jupyter Notebook (geopandas)Terminal=true

Iniciando Jupyter Notebook permitindo acesso via LAN

jupyter notebook --ip 0.0.0.0 --port 8888

Você também pode fazer umas configurações estáticas avançadas, mas isso somente se o comando acima não tiver funcionado:

jupyter notebook --generate-confignano ~/.jupyter/jupyter_notebook_config.py

Adicione as seguintes linhas ao arquivo:

c.NotebookApp.ip = '0.0.0.0' # listen on all IPsc.NotebookApp.token = ''     # disable authenticationc.NotebookApp.allow_origin = '*' # allow access from anywherec.NotebookApp.disable_check_xsrf = True # allow cross-site requestsc.NotebookApp.port = 8888

Referências

Tutorial de instalação oficial do Jupyter
https://jupyter.readthedocs.io/en/latest/install.html

Permitindo Jupyter pela LAN
https://stackoverflow.com/questions/39155953/exposing-python-jupyter-on-lan

Iniciando ambiente conda por script
https://stackoverflow.com/questions/34534513/calling-conda-source-activate-from-bash-script

You should also read: