I’m trying to get the spectrogram example (bokeh/examples/app/spectrogram at branch-3.0 · bokeh/bokeh · GitHub) to work in Jupyter Notebook on Ubuntu 18.04. It works for me in the terminal, but not when executing the Python code in a Notebook using the same conda environment.
The following code will result in a: RuntimeError: node.js v6.10.0 or higher is needed to allow compilation of custom models ("conda install nodejs" or follow https://nodejs.org/en/download/)
from bokeh.io import output_notebook, show
from bokeh.core.properties import Color, Float, Int, Override, Seq
from bokeh.models import Renderer
class WaterfallRenderer(Renderer): implementation = “waterfall.ts”
output_notebook()
``
!node --version
/bin/sh: 1: node: not found
See for all details this GitHub issue: [https://github.com/bokeh/bokeh/issues/8790](https://github.com/bokeh/bokeh/issues/8790)
Based on the comments I tried the following:
So indeed it cannot find NodeJS.
In the GitHub issue it was suggested to set `BOKEH_NODEJS_PATH`. However, how do I do this?
I have found a node installation here: /home/*username*/anaconda3/envs/bokeh/bin
Setting environment variables is platform- and even shell-specific. Assuming you are on linux with a bash like shell, you can set the variable when you start the notebook:
BOKEH_NODEJS_PATH="path/to/node" ipython notebook
or to set it permanently for a shell session use export:
export BOKEH_NODEJS_PATH="path/to/node"
If you are one a different shell you will have to do a web search since I am only immediately familiar with Bash-like shells.
That said, it still seems like the most likely explanation is that somehow the notebook is installed and running out of a different conda environment, one that does not have node installed.
Thanks,
Bryan
···
On Mar 26, 2019, at 12:44 AM, NumesSanguis <[email protected]> wrote:
Hello,
I'm trying to get the spectrogram example (https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram\) to work in Jupyter Notebook on Ubuntu 18.04. It works for me in the terminal, but not when executing the Python code in a Notebook using the same conda environment.
The following code will result in a: `RuntimeError: node.js v6.10.0 or higher is needed to allow compilation of custom models ("conda install nodejs" or follow https://nodejs.org/en/download/\)`
from bokeh.io import output_notebook, show
from bokeh.core.properties import Color, Float, Int, Override, Seq
from bokeh.models import Renderer
class WaterfallRenderer(Renderer):
__implementation__ = "waterfall.ts"
Based on the comments I tried the following:
!node --version
# /bin/sh: 1: node: not found
So indeed it cannot find NodeJS.
In the GitHub issue it was suggested to set `BOKEH_NODEJS_PATH`. However, how do I do this?
I have found a node installation here: /home/*username*/anaconda3/envs/bokeh/bin
At this point, BOKEH could use Node, but it was still not in the environment? Because the output was still:
!node --version
/bin/sh: 1: node: not found
!which node
empty
``
Also I got:
from bokeh.util.compiler import nodejs_version, npmjs_version
print(“node.js version : %s” % nodejs_version())
node.js version : v10.13.0
print(“npm version : %s” % npmjs_version())
npm version : None
``
Executing the following code with BOKEH_NODEJS_PATH set, just executing jupyter notebook and in terminal (with env active) all gave:
import sys
sys.executable
‘/home/user/anaconda3/envs/speechmod/bin/python’
``
So the Python kernel was from the same conda environment with everything I tried.
Conclusion
Even while the kernel that is used to execute Python code is the same, the environment is not if Jupyter Notebook is not called from the active conda environment matching the kernel.
Note: I don’t have Node installed in a conda environment (or system itself) besides speechmod.
Next up: Getting the Spectrogram example to work in a Jupyter Notebook.
···
On Wednesday, 27 March 2019 08:52:32 UTC+9, Bryan Van de ven wrote:
Hi,
Setting environment variables is platform- and even shell-specific. Assuming you are on linux with a bash like shell, you can set the variable when you start the notebook:
BOKEH_NODEJS_PATH="path/to/node" ipython notebook
or to set it permanently for a shell session use export:
export BOKEH_NODEJS_PATH="path/to/node"
If you are one a different shell you will have to do a web search since I am only immediately familiar with Bash-like shells.
That said, it still seems like the most likely explanation is that somehow the notebook is installed and running out of a different conda environment, one that does not have node installed.
I’m trying to get the spectrogram example (https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram) to work in Jupyter Notebook on Ubuntu 18.04. It works for me in the terminal, but not when executing the Python code in a Notebook using the same conda environment.
The following code will result in a: RuntimeError: node.js v6.10.0 or higher is needed to allow compilation of custom models ("conda install nodejs" or follow [https://nodejs.org/en/download/)](Download | Node.js))