Black Lives Matter. Please consider donating to Black Girls Code today.

Using Plotly with Jupyter notebook

This is an ill-formed and very technical question, but:

VPython 7 runs a user’s Python code in a local browser, and the vpython module sends commands to a local browser that calls upon the GlowScript library, which makes 3D animations using WebGL. That library, which is used in a more direct way in a browser at, now includes Plotly. (You can see this working at, and then click “View this program” to see the simple API that uses Plotly).

I am now able to use Plotly in VPython 7, running from for example IDLE or Spyder, but when I run in a Jupyter notebook Plotly fails to load. I suspect the difference is that Jupyter invokes require(), which is not used by GlowScript. I do see many calls to require() in plotly.js, but I don’t find an implementation of the function, which is puzzling, considering that when I use plotly.js in isolation it works fine without me including the require() library. I tried replacing all “require()” references in plotly.js with “plotly_require()”, and that made no difference.

It’s probably a forlorn hope, but does my problem ring any bells?


P.S. It may be irrelevant to the question above, but in the GlowScript library I initially got strange errors which went away after modifying attrConstant function to remove brackets, without of course knowing what on Earth I’m doing:

function attrConstant() {
  if (typeof value == 'string') { // inserted by Bruce Sherwood; don't know why this kludge is needed
	  value = value.replace(/\[/g,'')
	  value = value.replace(/\]/g,'')
  this.setAttribute(name, value);