Home Assistant Community Add-on: JupyterLab Lite

I have the same issue, on starting jupyterlab, I see this
you will need to update the settings in /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
which I do not find via terminal. I guess this file is somewhere inside a container/virtualenv/whatever. How can I get access to the file or change the configuraiton?

I solved this like that:TOKEN to be replaced of course

init_commands:
  - pip install hass_pyscript_kernel
  - pip install jupytext
  - jupyter pyscript install
  - >-
    sed -i 's/hass_token =.*/hass_token = TOKEN/'
    /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
  - >-
    sed -i 's/hass_host =.*/hass_host = LOCALHASSIP/'
    /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
  - >-
    sed -i 's/c.ServerApp.root_dir = .*/c.ServerApp.root_dir = \"\/config\"/'
    /etc/jupyter/jupyter_server_config.py

Note: I don’t think this is the way to do this „properly“, but it works for me.

1 Like

Thanks for posting this. I have a few questions about understanding what is happening in this config. Forgive my lack of understanding about what is happening.

Is the hass_token that is replaced with TOKEN a home assistant user id. It took me a while to realize the the regex needed a ‘/’ after the token to complete the command.

I assume the hass_host IP address needs to changed with my home assistants IP address on the network.

The last sed command causes my Jupyter instance to not default into the /home-assistant/ directory but instead dumps it into the config directory. Maybe that is its intended action, but I don’t understand what it is trying to fix

Thanks. I deleted too much when pasting here and updated my post. The IP is the local one from the homeassistant indeed.

The intent of the folder change is, so I can enter the /pyscript/ folder easier.

JupyterLab seems to work fine so far, but every few minutes the Jupiter kernel crashes:

The kernel for home-assistant/GETTING_STARTED.ipynb appears to have died. It will restart automatically.

The log files don’t show anything of interest. Any ideas?