hass-pyscript-jupyter icon indicating copy to clipboard operation
hass-pyscript-jupyter copied to clipboard

Issues running the kernel

Open jdenver13 opened this issue 3 years ago • 2 comments

After installing on my Mac, I cant get the hass-pyscript-jupyter to work Running 'jupyter kernelspec list':

[ListKernelSpecs] WARNING | Native kernel (python3) is not available
[ListKernelSpecs] WARNING | Native kernel (python3) is not available
Available kernels:
  pyscript    /usr/local/share/jupyter/kernels/pyscript

Running 'jupyter pyscript info':

hass_pyscript_kernel version 1.0.0 installed
Kernel pyscript installed in /usr/local/share/jupyter/kernels/pyscript
Config settings from /usr/local/share/jupyter/kernels/pyscript/pyscript.conf:
    hass_host = 192.168.1.63
    hass_url = http://192.168.1.63:8123
    hass_token = 6MTYxNzE5MDI1OSwiZXhwIjoxOTMyNTUwyoPnHd8vvF0upJAKRCzsek
    hass_proxy = None

If I run 'juptyer notebook', all seems ok:

[I 2021-03-31 13:42:38.768 LabApp] JupyterLab extension loaded from /usr/local/Cellar/jupyterlab/3.0.12/libexec/lib/python3.9/site-packages/jupyterlab
[I 2021-03-31 13:42:38.769 LabApp] JupyterLab application directory is /usr/local/Cellar/jupyterlab/3.0.12/libexec/share/jupyter/lab
[I 13:42:38.776 NotebookApp] Serving notebooks from local directory: /Users/denver
[I 13:42:38.777 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 13:42:38.777 NotebookApp] http://localhost:8888/?token=8c639d693d8f0
[I 13:42:38.777 NotebookApp]  or http://127.0.0.1:8888/?token=8c639d693d8f0
[I 13:42:38.777 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 13:42:38.781 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///Users/denver/Library/Jupyter/runtime/nbserver-4284-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=8c639d693d8f0
     or http://127.0.0.1:8888/?token=8c639d693d8f0

If I then select 'hass pyscript' in Jupyter notebooks 'New' menu I get:

[I 18:46:35.274 NotebookApp] Creating new notebook in 
[I 18:46:36.394 NotebookApp] Kernel started: 5f607b3a-3390-4b7c-bc5b-939c3f47782d, name: pyscript
[W 18:46:36.442 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20210331184622 (::1) 28.070000ms referer=http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=pyscript
/usr/local/Cellar/jupyterlab/3.0.12/libexec/bin/python3.9: No module named hass_pyscript_kernel
[I 18:46:39.380 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
/usr/local/Cellar/jupyterlab/3.0.12/libexec/bin/python3.9: No module named hass_pyscript_kernel
[I 18:46:42.389 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
/usr/local/Cellar/jupyterlab/3.0.12/libexec/bin/python3.9: No module named hass_pyscript_kernel
[I 18:46:45.400 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
/usr/local/Cellar/jupyterlab/3.0.12/libexec/bin/python3.9: No module named hass_pyscript_kernel
[I 18:46:48.413 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
/usr/local/Cellar/jupyterlab/3.0.12/libexec/bin/python3.9: No module named hass_pyscript_kernel
[W 18:46:51.422 NotebookApp] KernelRestarter: restart failed
[W 18:46:51.423 NotebookApp] Kernel 5f607b3a-3390-4b7c-bc5b-939c3f47782d died, removing from map.
[W 18:47:36.469 NotebookApp] Timeout waiting for kernel_info reply from 5f607b3a-3390-4b7c-bc5b-939c3f47782d
[E 18:47:36.472 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 5f607b3a-3390-4b7c-bc5b-939c3f47782d)

Any ideas where to go from here or what to try please.

jdenver13 avatar Mar 31 '21 17:03 jdenver13

Came across the same problem. The kernelspec refers to python as the python binary to use, but it's not using the one which the shell points to when in a virtualenv. Not sure if this is a problem with jupyter or with this tool.

This can be 'fixed' by setting the binary to the one which has access to the hass_pyscript_kernel module.

  1. Run jupyter kernelspec list
  2. Open the file kernel.json in the folder which is listed next to pyscript in the previous command's output
  3. Change python in argv to whatever comes out of which python when running that in your virtualenv

On to the next problem, connection refused... 😞

rhtenhove avatar Dec 24 '22 18:12 rhtenhove

Any update on this? I also have this problem. HTTP 400, 401 and 403s

Quadrubo avatar Apr 28 '23 20:04 Quadrubo