kleinee/jns

notebook directory auto-setup not setup correctly

Closed this issue · 5 comments

I have found a couple of issues while following this on Mar 13 2018 and I wanted to put out some notes to make it easier:

  1. notebooks directory may not set up correctly in the config file:
    this line:
    arr+=(["$app.notebook_dir"]="$app.notebook_dir = '/home/$(logname)/notebooks'")
    created: '/home//notebooks'
    in my config file as the wildcard did not fill in.

I was able to correct it by replacing it with '/home/pi/notebooks'

  1. for a fresh install, NodeJS (and NPM) should be installed first, or at least before ./conf_jupyter.sh is run. For RasPi 3B, That can be installed via the ARM v6 version of Node (Linux Binaries (ARM)) at https://nodejs.org/en/download/

Hi Todd-Z-Li,
Thanks for using my little project. To verify your findings I just created a script echoing what is written into the config file:

#!/bin/bash
# set up dictionary of changes for jupyter_config.py
declare -A arr
app='c.NotebookApp'
arr+=(["$app.open_browser"]="$app.open_browser = False")
arr+=(["$app.ip"]="$app.ip ='*'")
arr+=(["$app.port"]="$app.port = 8888")
arr+=(["$app.enable_mathjax"]="$app.enable_mathjax = True")
arr+=(["$app.notebook_dir"]="$app.notebook_dir = '/home/$(logname)/notebooks'")
arr+=(["$app.password"]="$app.password = 'sha1:5815fb7ca805:f09ed218dfcc908acb3e29c3b697079fea37486a'")

for key in ${!arr[@]};do
        echo "${arr[${key}]}"
done

Subject to logname being pi , executing this yields:

c.NotebookApp.password = 'sha1:5815fb7ca805:f09ed218dfcc908acb3e29c3b697079fea37486a'
c.NotebookApp.ip ='*'
c.NotebookApp.enable_mathjax = True
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.notebook_dir = '/home/pi/notebooks'

which is exactly as intended. I suspect that logname is / was not defined on your system. At the terminal just type logname to verify. This would explain why you observed c.NotebookApp.notebook_dir = '/home//notebooks'.

As far as your comment on NodeJS / NPM is concerned: I'll take a look later. Any particular reason why you suggest installation before conf_jupyter.sh is being executed? It is certainly easy to shift the one line NodeJS installation towards the beginning of the script to satisfy your suggestion.

@kleinee I see that I indeed have no login name, I am not sure why that is.

Regarding the nodejs, I was using a fresh install (from NOOBS), I received this when first time I ran the ./conf_jupyter.sh:


Writing default config to: /home/pi/.jupyter/jupyter_notebook_config.py
logname: no login name
Installing IPython kernel spec
Enabling: jupyterlab
- Writing config: /home/pi/.jupyter
    - Validating...
      jupyterlab  OK
Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: OK
Enabling notebook extension bqplot/extension...
      - Validating: OK
Enabling IPython clusters tab
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 38002  100 38002    0     0  85191      0 --:--:-- --:--:-- --:--:-- 1654k
n-install: ERROR:
  Aborting, because n and/or Node.js-related binaries are already
  in the $PATH:
           
         /usr/bin/node
  
  Please remove any existing n, Node.js installation, then try 
  again.
  

Errored, use --debug for full output:
ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.

Errored, use --debug for full output:
ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.

Errored, use --debug for full output:
ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.

which was resolved once I installed NodeJS from the node website

@Todd-Z-Li Not sure what caused the loss of logname on your system. As stated in README.md I suggest to start fresh installs withe the official Raspbian Stretch Lite image. Well NOOBS is official a well you might argue which is correct. Did you start with a fresh NOOBS image and did it come with NodeJS pre-installed? Whilst not the intended starting point one could check whether NodeJS is installed:

if which node > /dev/null
    then
        echo "node is installed, skipping..."
    else
        # install node
fi

Reluctant though as this does not determine, whether the installed NodeJS version satisfies the requirements of the Jupyter installation. That is the reason I opted to install using n-install. If you have no objection I close this issue.

so I think there was NodeJS, but some reason not the right version or location? I think it might be related to the lack of log names. It was a fresh install but I think I changed VNC or login permissions to enable myself access from remote computer

Closed as the scripts work as intended using Raspbian Stretch Lite as a starting point.