Home Assistant Community Add-on: JupyterLab Lite

This add-on is provided by the Home Assistant Community Add-ons project.

GitHub Release GitLab CI Project Stage Project Maintenance

Supports armhf Architecture Supports armv7 Architecture Supports aarch64 Architecture Supports amd64 Architecture Supports i386 Architecture

Create documents containing live code, equations, visualizations,
and explanatory text.

About


JupyterLab is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

This add-on runs JupyterLab, which is the next-generation user interface for Project Jupyter. It is an extensible environment for interactive and reproducible computing, based on the Jupyter Notebook and Architecture.

Installation


The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

  1. Search for the “JupyterLab Lite” add-on in the add-on store and install it.
  2. Install the “JupyterLab Lite” add-on.
  3. Start the “JupyterLab Lite” add-on
  4. Check the logs of the “JupyterLab Lite” add-on to see if everything went well.
  5. Ready to go!

Support


You can always try to get support from the community here at the Home Assistant community forums, join the conversation!

Questions? You have several options to get them answered:

You could also open an issue on GitHub, in case you ran into a bug, or maybe you have an idea on improving the addon:

:information_source: At this moment our Home Assistant Community Add-ons Discord chat server and GitHub are our only official support channels. All others rely on community effort.

Repository on GitHub


Looking for more add-ons?


The primary goal of our add-ons project is to provide you (as a Home Assistant user) with additional, high quality, add-ons that allow you to take your automated home to the next level.

Check out some of our other add-ons in our Home Assistant Community Add-ons project.

1 Like

About the author of this add-on

Hi there!

I am Franck Nijhof, and I have 30 years of programming experience, in many languages. I am using this experience to work on the Home Assistant project by giving back my knowledge and time to the open source community.

The add-on you are currently looking at right now was developed/packaged by me. It is not the only add-on I have created; there are many many more :wink:

However, I have a problem… I am an addict. A :coffee: addict that is. Lucky for you, I turn that C8H10N4O2 (caffeine molecule) into code (and add-ons)!

If you want to show your appreciation, consider buying me a cup of high octane wakey juice by clicking on the “By me a coffee” image below! :heart:

Buy me a coffee

Or, become a Patron and support my work!

Enjoy your add-on, while I enjoy the brain juice. :coffee:

Thanks for all the :two_hearts:

…/Frenck

Join our Discord server Follow me on Twitter Flollow me on Instragram Follow me on GitHub Follow me on YouTube Follow me on Twitch patreon-icon

P.S.: In case you want to ask me a question: AMA (Ask Me Anything). Most of the time I am online at the Discord chat. (I go by @Frenck in there as well).

Can’t wait to see what this does, but I’ve already run into problems. After installing and opening the UI, I’ve run the “All Cells” and have been met with this:

YAML tag !include_dir_merge_list is not supported
YAML tag !include_dir_merge_named is not supported
YAML tag !include_dir_list is not supported


ValueError                                Traceback (most recent call last)
<ipython-input-3-b0a168cdf11c> in <module>
      1 from detective.core import db_from_hass_config
----> 2 db = db_from_hass_config()

/usr/local/lib/python3.6/dist-packages/detective/core.py in db_from_hass_config(path, **kwargs)
     17         path = config.find_hass_config()
     18 
---> 19     url = config.db_url_from_hass_config(path)
     20     return HassDatabase(url, **kwargs)
     21 

/usr/local/lib/python3.6/dist-packages/detective/config.py in db_url_from_hass_config(path)
    117     if not os.path.isfile(default_path):
    118         raise ValueError(
--> 119             "Unable to determine DB url from hass config at {}".format(path)
    120         )
    121 

ValueError: Unable to determine DB url from hass config at /config

I suspect it may have something to do with the fact that I’m using a Ubuntu server with MySQL as the data handler?

Not sure what to do.

getting this error message when starting

fatal: cannot change to '/config/notebooks//home-assistant': No such file or directory

should I add this manually?
Hassio latest build 0.84.6

:tada: Release v0.2.0

Full Changelog

Changed

  • Fixes spelling error in Dockerfile
  • Removes BountySource links
  • Updates maintenance year to 2019
  • Refactor of GitLab CI
  • Configure Renovate (#10)
  • Updates beautifulsoup4 to v4.7.1 (#13)
  • Updates bokeh to v1.0.4 (#15)
  • Updates psycopg2 to v2.7.7 (#19)
  • Updates scrapy to v1.6.0 (#23)
  • Updates python-dateutil to v2.8.0 (#26)
  • Updates nbconvert to v5.4.1 (#28)
  • Updates mysqlclient to v1.4.2.post1 (#30)
  • Updates numpy to v1.16.2 (#32)
  • Upgrades GPG to 2.2.4-1ubuntu1.2
  • Upgrades libmysql to 5.7.25-0ubuntu0.18.04.2
  • Upgrades libzmq5 to 4.2.5-1ubuntu0.1
  • Upgrade lua-resty-http to 0.13-0
  • Updates matplotlib to v3.0.3 (#33)
  • Updates SQLAlchemy to v1.3.1 (#36)
  • Updates influxdb to v5.2.2 (#38)
  • Upgrades add-on base image to 3.0.0
  • Remove obsolete machine tags
  • Makes log_level optional
  • Removes custom log format override
  • Upgrades libtiff5-dev to 4.0.9-5ubuntu0.2
  • Upgrades NodeJS to 8.15.1-1nodesource1
  • Rewrite add-on onto Bashio
  • Makes NGinx wait for Jupyter before starting
  • Updates documentation for ARMv7
  • Workaround for CPython/PIP package order issue
  • Updates pandas to v0.24.2 (#37)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

:tada: Release v0.3.0

Full Changelog

This release upgrades all internals, and contains the first major and stable release of Jupyter Lab as well! :tada:

Changed

  • :arrow_up: Updates bokeh to v1.2.0 (#56)
  • :arrow_up: Updates geopy to v1.20.0 (#54)
  • :arrow_up: Updates nbconvert to v5.5.0 (#52)
  • :arrow_up: Updates psycopg2 to v2.8.3 (#58)
  • :arrow_up: Upgrades MySQL client to 5.7.26-0ubuntu0.18.04.1
  • :arrow_up: Upgrades libpng to 1.6.34-1ubuntu0.18.04.2
  • :arrow_up: Upgrades libpg to 10.8-0ubuntu0.18.04.1
  • :arrow_up: Upgrades python3-distutils to 3.6.8-1~18.04
  • :arrow_up: Upgrades nodejs to 8.16.0-1nodesource1
  • :arrow_up: Upgrades numpy to 1.16.4
  • :arrow_up: Updates SQLAlchemy to v1.3.5 (#59)
  • :pencil2: Maintaince -> Maintenance
  • :arrow_up: Upgrades libpq to 10.9-0ubuntu0.18.04.1
  • :arrow_up: Updates ipywidgets to v7.5.0 (#61)
  • :arrow_up: Updates matplotlib to v3.1.1 (#63)
  • :arrow_up: Updates jupyterlab_github to v1 (#64)
  • :arrow_up: Updates jupyterlab to v1.0.2 (#65)
  • :arrow_up: Updates scrapy to v1.7.1 (#66)
  • :arrow_up: Updates pandas to v0.25.0 (#67)
  • :arrow_up: Updates beautifulsoup4 to v4.8.0 (#68)
  • :arrow_up: Upgrades libzmq to 4.2.5-1ubuntu0.2
  • :arrow_up: Upgrades libssl-dev to 1.1.1-1ubuntu2.1~18.04.4
  • :arrow_up: Upgrades jupyter-widgets/jupyterlab-manager to 1.0
  • :arrow_up: Upgrades add-on base image to v3.1.3

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

:tada: Release v0.3.1

Full Changelog

This is a general maintenance release.

Changed

  • :arrow_up: Updates numpy to v1.17.0 (#74)
  • :arrow_up: Updates pandas-datareader to v0.7.4 (#75)
  • :arrow_up: Updates ipywidgets to v7.5.1 (#76)
  • :arrow_up: Updates bokeh to v1.3.4 (#80)
  • :arrow_up: Updates nbconvert to v5.6.0 (#81)
  • :arrow_up: Upgrades libmysqlclient-dev to 5.7.27-0ubuntu0.18.04.1
  • :arrow_up: Upgrades libmysqlclient20 to 5.7.27-0ubuntu0.18.04.1
  • :arrow_up: Upgrades libpq-dev to 10.10-0ubuntu0.18.04.1
  • :arrow_up: Upgrades libpq5 to 10.10-0ubuntu0.18.04.1
  • :arrow_up: Updates mysqlclient to v1.4.4 (#84)
  • :arrow_up: Upgrades nginx to 1.14.0-0ubuntu1.5
  • :arrow_up: Updates SQLAlchemy to v1.3.7 (#85)
  • :arrow_up: Updates scrapy to v1.7.3 (#78)
  • :arrow_up: Updates pandas to v0.25.1 (#90)
  • :arrow_up: Upgrades add-on base image to v3.2.0
  • :arrow_up: Upgrades nginx to 1.14.0-0ubuntu1.6
  • :arrow_up: Upgrades libnginx-mod-http-lua to 1.14.0-0ubuntu1.6
  • :ambulance: Fixes path handling for SSL certificates
  • :hammer: Updates HA Auth URL in NGinx LUA script
  • :hammer: Use Hass.io DNS as NGinx resolver
  • :arrow_up: Upgrades nodejs to 8.16.1-1nodesource1
  • :arrow_up: Updates jupyterlab to v1.0.9 (#89)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Thanks for this add-on. I’ve followed the instructions and now I’m getting asked for a username and password when hitting the local IP on port 7777.

The Jupyterlab terminal comes up with /bin/sh. Is it possible to start (by default) with a different shell, e.g. bash or zsh?

Hi,
I can not start the addon. It crashes during startup process.
I have HA Supervised. Healthy.
Here is the log in debug mode. There is info: “s6-svwait: fatal: supervisor died”

Hope you can help me. Thank you in advance.


-----------------------------------------------------------
 Add-on version: 0.8.1
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 11 (bullseye)  (amd64 / qemux86-64)
 Home Assistant Core: 2022.9.0
 Home Assistant Supervisor: 2022.08.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to DEBUG
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/02-set-timezone.sh
[12:03:25] INFO: Configuring timezone
cont-init: info: /etc/cont-init.d/02-set-timezone.sh exited 0
cont-init: info: running /etc/cont-init.d/jupyter.sh
cont-init: info: /etc/cont-init.d/jupyter.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
cont-init: info: running /etc/cont-init.d/notebooks.sh
[12:03:25] WARNING: Not updating Home Assistant notebook!
[12:03:25] WARNING: You have made local changes, which we will not overwrite.
[12:03:25] WARNING: Not updating Bokeh examples notebook!
[12:03:25] WARNING: You have made local changes, which we will not overwrite.
cont-init: info: /etc/cont-init.d/notebooks.sh exited 0
cont-init: info: running /etc/cont-init.d/system-packages.sh
cont-init: info: /etc/cont-init.d/system-packages.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun jupyter (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[12:03:25] INFO: Starting the Jupyter server...
[D 2022-09-08 12:03:29.015 ServerApp] Searching ['/config/notebooks', '/root/.jupyter', '/root/.local/etc/jupyter', '/usr/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[D 2022-09-08 12:03:29.016 ServerApp] Looking for jupyter_config in /etc/jupyter
[D 2022-09-08 12:03:29.016 ServerApp] Looking for jupyter_config in /usr/local/etc/jupyter
[D 2022-09-08 12:03:29.016 ServerApp] Looking for jupyter_config in /usr/etc/jupyter
[D 2022-09-08 12:03:29.016 ServerApp] Looking for jupyter_config in /root/.local/etc/jupyter
[D 2022-09-08 12:03:29.017 ServerApp] Looking for jupyter_config in /root/.jupyter
[D 2022-09-08 12:03:29.017 ServerApp] Looking for jupyter_config in /config/notebooks
[D 2022-09-08 12:03:29.019 ServerApp] Looking for jupyter_server_config in /etc/jupyter
[D 2022-09-08 12:03:29.019 ServerApp] Looking for jupyter_server_config in /usr/local/etc/jupyter
[D 2022-09-08 12:03:29.019 ServerApp] Looking for jupyter_server_config in /usr/etc/jupyter
[D 2022-09-08 12:03:29.020 ServerApp] Looking for jupyter_server_config in /root/.local/etc/jupyter
[D 2022-09-08 12:03:29.020 ServerApp] Looking for jupyter_server_config in /root/.jupyter
[D 2022-09-08 12:03:29.020 ServerApp] Looking for jupyter_server_config in /config/notebooks
[D 2022-09-08 12:03:29.025 ServerApp] Paths used for configuration of jupyter_server_config: 
    	/etc/jupyter/jupyter_server_config.json
[D 2022-09-08 12:03:29.025 ServerApp] Paths used for configuration of jupyter_server_config: 
    	/usr/local/etc/jupyter/jupyter_server_config.d/jupyterlab.json
    	/usr/local/etc/jupyter/jupyter_server_config.d/nbclassic.json
    	/usr/local/etc/jupyter/jupyter_server_config.d/notebook_shim.json
    	/usr/local/etc/jupyter/jupyter_server_config.json
[D 2022-09-08 12:03:29.026 ServerApp] Paths used for configuration of jupyter_server_config: 
    	/usr/etc/jupyter/jupyter_server_config.json
[D 2022-09-08 12:03:29.027 ServerApp] Paths used for configuration of jupyter_server_config: 
    	/root/.local/etc/jupyter/jupyter_server_config.json
[D 2022-09-08 12:03:29.028 ServerApp] Paths used for configuration of jupyter_server_config: 
    	/root/.jupyter/jupyter_server_config.json
[D 2022-09-08 12:03:29.028 ServerApp] Paths used for configuration of jupyter_server_config: 
    	/config/notebooks/jupyter_server_config.json
[I 2022-09-08 12:03:29.061 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-09-08 12:03:29.080 ServerApp] nbclassic | extension was successfully linked.
[D 2022-09-08 12:03:30.475 ServerApp] Paths used for configuration of jupyter_notebook_config: 
    	/root/.jupyter/jupyter_notebook_config.json
[D 2022-09-08 12:03:30.475 ServerApp] Paths used for configuration of jupyter_notebook_config: 
    	/etc/jupyter/jupyter_notebook_config.json
[D 2022-09-08 12:03:30.476 ServerApp] Paths used for configuration of jupyter_notebook_config: 
    	/usr/local/etc/jupyter/jupyter_notebook_config.d/jupyterlab.json
    	/usr/local/etc/jupyter/jupyter_notebook_config.json
[D 2022-09-08 12:03:30.477 ServerApp] Paths used for configuration of jupyter_notebook_config: 
    	/usr/etc/jupyter/jupyter_notebook_config.json
[D 2022-09-08 12:03:30.478 ServerApp] Paths used for configuration of jupyter_notebook_config: 
    	/root/.local/etc/jupyter/jupyter_notebook_config.json
[D 2022-09-08 12:03:30.478 ServerApp] Paths used for configuration of jupyter_notebook_config: 
    	/root/.jupyter/jupyter_notebook_config.json
[I 2022-09-08 12:03:30.478 ServerApp] notebook_shim | extension was successfully linked.
[D 2022-09-08 12:03:30.481 ServerApp] Config changed: {'NotebookApp': {}, 'ServerApp': {'log_level': 'DEBUG', 'jpserver_extensions': <LazyConfigValue value={'jupyterlab': True, 'nbclassic': True, 'notebook_shim': True}>}}
[I 2022-09-08 12:03:30.553 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-09-08 12:03:30.555 LabApp] JupyterLab extension loaded from /usr/local/lib/python3.9/dist-packages/jupyterlab
[I 2022-09-08 12:03:30.556 LabApp] JupyterLab application directory is /usr/local/share/jupyter/lab
[I 2022-09-08 12:03:30.563 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-09-08 12:03:30.573 ServerApp] nbclassic | extension was successfully loaded.
[C 2022-09-08 12:03:30.574 ServerApp] Running as root is not recommended. Use --allow-root to bypass.
[D 2022-09-08 12:03:30.575 ServerApp] Exiting application: jupyter-server
[12:03:30] WARNING: Jupyter crashed, halting add-on
[12:03:30] INFO: Jupyter stopped, restarting...
s6-rc: info: service legacy-services: stopping
[12:03:30] INFO: NGINX stopped, restarting...
s6-svwait: fatal: supervisor died
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
[12:03:30] INFO: Jupyter stopped, restarting...
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Home Assistant Supervisor

|Host Operating System|Debian GNU/Linux 11 (bullseye)|
| --- | --- |
|Update Channel|stable|
|Supervisor Version|supervisor-2022.08.6|
|Agent Version|1.2.2|
|Docker Version|20.10.17|
|Disk Total|162.6 GB|
|Disk Used|51.2 GB|
|Healthy|true|
|Supported|true|
|Supervisor API|ok|
|Version API|ok|
|Installed Add-ons|Glances (0.16.0), Terminal & SSH (9.6.1), InfluxDB (4.5.0), Grafana (7.6.0), Mosquitto broker (6.1.3), AirCast (3.4.1), Studio Code Server (5.3.0), File editor (5.4.0), Log Viewer (0.14.0), Samba share (10.0.0), AdGuard Home (4.7.3), ZeroTier One (0.15.1), Apache2 Minimal (2.4.2), TasmoAdmin (0.20.0), DeepStack (2021.09.1), MariaDB (2.5.1), Zigbee2MQTT (1.27.2-1), ESPHome (2022.8.3), Node-RED (13.3.2), Frigate NVR (3.1), JupyterLab (0.8.1)|

New update but still it doesn’t work unfortunately:

[19:09:40] INFO: Starting NGinx...
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
1 Like

Thanks for this!

Is it possible to access it via local_ip:port without going through the HA UI (like I do for your really nice unifi add-on)?

I saw this post talk about accessing via local_ip:7777, but that doesn’t work for me, and I don’t see any mention of port in the documentation. I do see port 28459 in the logs, but local_ip:28459 doesn’t work either

I have installed the add-on and try to run the ‘getting started.ipydb’ document. But on step 4

I get this error:

I just did a standard installation and didn’t changed anything.

I get the exact same error with most recent versions of Home Assistant (2023.8.0) and JupyterLab (0.11.1) with GETTING_STARTED.ipynb on step 4.

I found this solution for the error on Stackoverflow: python - ObjectNotExecutableError when executing any SQL query using AsyncEngine - Stack Overflow
It suggests to wrap the query string with the text function from sqlalchemy, which seems to be a breaking change since version 2 of sqlalchemy.
This is how I solved the above error:

# insert this at the top of step 4:
from sqlalchemy import text

# wrap the DB statement with `text()`:
for event in db.perform_query(text("SELECT * FROM events WHERE event_type = 'call_service' ORDER BY time_fired")):

Later at step 11 I ran into other errors, but at least the DB connection was working to get some data out.

1 Like

Thank you!
Adding the text() function fixed it for me. Now just to work out why I am getting no data in the report.

Thanks,
Chris.

Hi,
This looks really intersting, but am getting stuck with an error on this cell:
df = df[df[‘domain’]==‘sensor’]
df = functions.generate_features(df)
df = functions.format_dataframe(df)


KeyError Traceback (most recent call last)
File /usr/local/lib/python3.11/dist-packages/pandas/core/indexes/base.py:3790, in Index.get_loc(self, key)
3789 try:
→ 3790 return self._engine.get_loc(casted_key)
3791 except KeyError as err:

File index.pyx:152, in pandas._libs.index.IndexEngine.get_loc()

File index.pyx:181, in pandas._libs.index.IndexEngine.get_loc()

File pandas/_libs/hashtable_class_helper.pxi:7080, in pandas._libs.hashtable.PyObjectHashTable.get_item()

File pandas/_libs/hashtable_class_helper.pxi:7088, in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘domain’

The above exception was the direct cause of the following exception:

KeyError Traceback (most recent call last)
Cell In[7], line 1
----> 1 df = df[df[‘domain’]==‘sensor’]
2 df = functions.generate_features(df)
3 df = functions.format_dataframe(df)

File /usr/local/lib/python3.11/dist-packages/pandas/core/frame.py:3896, in DataFrame.getitem(self, key)
3894 if self.columns.nlevels > 1:
3895 return self._getitem_multilevel(key)
→ 3896 indexer = self.columns.get_loc(key)
3897 if is_integer(indexer):
3898 indexer = [indexer]

File /usr/local/lib/python3.11/dist-packages/pandas/core/indexes/base.py:3797, in Index.get_loc(self, key)
3792 if isinstance(casted_key, slice) or (
3793 isinstance(casted_key, abc.Iterable)
3794 and any(isinstance(x, slice) for x in casted_key)
3795 ):
3796 raise InvalidIndexError(key)
→ 3797 raise KeyError(key) from err
3798 except TypeError:
3799 # If we have a listlike key, _check_indexing_error will raise
3800 # InvalidIndexError. Otherwise we fall through and re-raise
3801 # the TypeError.
3802 self._check_indexing_error(key)

KeyError: ‘domain’

1 Like

Stuck here also. Did anyone found a solution?

Hi, did anyone managed to get the pyscript integration to work with this add on? In my case the pyscript kernel crashes whenever I run a notebook with it,

This is my configuration:

github_access_token: ""
system_packages: []
init_commands:
  - pip install appdaemon pandas numpy hass_pyscript_kernel matplotlib
  - pip install ipykernel
  - jupyter pyscript install

Log says:


hass_pyscript_kernel: unable to connect to host localhost:8123 (Connect call failed ('127.0.0.1', 8123))
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fd8694e2390>
[I 2023-11-23 22:07:36.526 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (4/5), new random ports
hass_pyscript_kernel: unable to connect to host localhost:8123 (Connect call failed ('127.0.0.1', 8123))
Unclosed client session

Any clues?

I‘m using MiniConda on an separate docker-machine and it works fine.
On a new install, you’ll need to edit the pyscript.conf file.
Have a look at https://github.scom/craigbarratt/hass-pyscript-jupyter/blob/master/README.md#installation