vpython / vpython-jupyter

3D visualization made easy
MIT License
141 stars 64 forks source link

Binder error #30

Closed mwcraig closed 5 years ago

mwcraig commented 5 years ago

@jcoady -- I tried the latest on binder and get this error in the javascript console:

main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:24955 Could not open comm  --  Error: Class glow not found in registry 
    at main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:24919
    at new Promise (<anonymous>)
    at Object.load_class (main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:24904)
    at CommManager.comm_open (main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:36618)
    at i (main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:2)
    at Kernel._handle_iopub_message (main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:38098)
    at Kernel._finish_ws_message (main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:37890)
    at main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:37881
(anonymous) @ main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:24955
main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:37882 Couldn't process kernel message WrappedError

The binder URL I used is https://mybinder.org/v2/gh/vpython/vpython-jupyter/master?filepath=index.ipynb

mwcraig commented 5 years ago

I ran the Binary Star notebook (I like binary stars)

jcoady commented 5 years ago

I have seen that error before and I found that if I save the notebook and close the notebook and then open it back up and try running the notebook again the error goes away. I have seen it on my local machine so I don't think it is a binder issue. Sometimes I try clear the browser data and the error goes away for me. Try doing some of these things and see if the error goes away for you.

John

From: "Matt Craig" notifications@github.com To: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com Cc: "johncoady" johncoady@shaw.ca, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 8:13:17 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I ran the Binary Star notebook (I like binary stars)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

jcoady commented 5 years ago

Hi Matt

I am seeing this error also. I even see it if I create an new environment and install vpython 7.5.0 in that environment and run jupyter notebook from that environment. So I don't think it is from some recent vpython update since it happens with the last stable vpython release. Maybe it is something new from vpython dependency packages that get installed along with vpython.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:12:47 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I have seen that error before and I found that if I save the notebook and close the notebook and then open it back up and try running the notebook again the error goes away. I have seen it on my local machine so I don't think it is a binder issue. Sometimes I try clear the browser data and the error goes away for me. Try doing some of these things and see if the error goes away for you.

John

From: "Matt Craig" notifications@github.com To: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com Cc: "johncoady" johncoady@shaw.ca, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 8:13:17 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I ran the Binary Star notebook (I like binary stars)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

jcoady commented 5 years ago

Hi Matt

I reproduced the problem on my local machine. The way I fixed it was to delete the vpython contents of the nbextensions directory on my machine. On my Windows computer the nbextensions directory is located at

AppData/Roaming/jupyter/nbextensions

In this nbextensions directory I deleted the file vpython_version, and the directories vpython_data and vpython_libraries.

Then when execute the line

from vpython import *

in a jupyter notebook then this data will be copied anew from the vpython package to the nbextensions directory.

We have some install logic to only copy these files over to nbextensions directory when there is a new release and not perform the copy every time the user imports vpython into a notebook. Since I updated the file vpython_libraries/glowcomm.js this file will only get installed properly if you bump up the vpython release number or delete the vpython data in nbextensions directory.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:59:07 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

Hi Matt

I am seeing this error also. I even see it if I create an new environment and install vpython 7.5.0 in that environment and run jupyter notebook from that environment. So I don't think it is from some recent vpython update since it happens with the last stable vpython release. Maybe it is something new from vpython dependency packages that get installed along with vpython.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:12:47 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I have seen that error before and I found that if I save the notebook and close the notebook and then open it back up and try running the notebook again the error goes away. I have seen it on my local machine so I don't think it is a binder issue. Sometimes I try clear the browser data and the error goes away for me. Try doing some of these things and see if the error goes away for you.

John

From: "Matt Craig" notifications@github.com To: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com Cc: "johncoady" johncoady@shaw.ca, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 8:13:17 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I ran the Binary Star notebook (I like binary stars)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

jcoady commented 5 years ago

Hi Matt

I was able to run the all of the demo notebooks on Binder from the link you provided.

https://mybinder.org/v2/gh/vpython/vpython-jupyter/master?filepath=index.ipynb

which uses vpython version = ['7.5.2.beta1+9.gec99491', 'jupyter']

The first time you run a notebook then you will see the error you reported. But if you close the notebook and run it again then you will see that it works. All the other demo notebooks will then work on Binder.

I think that the problem occurs when you run the first notebook after Binder finishes launching is because we install vpython data to the nbextensions directory the first time you execute "from vpython import * " in a notebook. The installation is done in the file with_notebook.py and right after the copying of files to nbextensions we execute the glowcomm.js code. So there may be a timing issue causing the problem.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Tuesday, October 8, 2019 5:04:43 AM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

Hi Matt

I reproduced the problem on my local machine. The way I fixed it was to delete the vpython contents of the nbextensions directory on my machine. On my Windows computer the nbextensions directory is located at

AppData/Roaming/jupyter/nbextensions

In this nbextensions directory I deleted the file vpython_version, and the directories vpython_data and vpython_libraries.

Then when execute the line

from vpython import *

in a jupyter notebook then this data will be copied anew from the vpython package to the nbextensions directory.

We have some install logic to only copy these files over to nbextensions directory when there is a new release and not perform the copy every time the user imports vpython into a notebook. Since I updated the file vpython_libraries/glowcomm.js this file will only get installed properly if you bump up the vpython release number or delete the vpython data in nbextensions directory.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:59:07 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

Hi Matt

I am seeing this error also. I even see it if I create an new environment and install vpython 7.5.0 in that environment and run jupyter notebook from that environment. So I don't think it is from some recent vpython update since it happens with the last stable vpython release. Maybe it is something new from vpython dependency packages that get installed along with vpython.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:12:47 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I have seen that error before and I found that if I save the notebook and close the notebook and then open it back up and try running the notebook again the error goes away. I have seen it on my local machine so I don't think it is a binder issue. Sometimes I try clear the browser data and the error goes away for me. Try doing some of these things and see if the error goes away for you.

John

From: "Matt Craig" notifications@github.com To: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com Cc: "johncoady" johncoady@shaw.ca, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 8:13:17 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I ran the Binary Star notebook (I like binary stars)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

jcoady commented 5 years ago

Hi Matt

Further to my previous reply. The error you reported was

main.min.js?v=617dbb6b838f3495e90f667d4b1f2fa9:24955 Could not open comm -- Error: Class glow not found in registry

This seems to be due to the fact that glowcomm.js has not yet run on the front-end javascript in the notebook. In the file with_notebook.py there is a line of code wait for a second to give glowcomm a chance to run before attempting to connect the comm channel. It is line number 104 in with_notebook.py

time.sleep( 1 ) # allow some time for javascript code above to run before attempting to setup Comm Channel

I think the fix is to increase this delay if we just copied the files to nbextensions directory which is indicated with the flag "transfer" set earlier in the file. We can modify line 104 to be something like

if transfer: time.sleep( 5 ) # allow some time for javascript code above to run after transfer to nbextensions before attempting to setup Comm Channel else time.sleep( 1 ) # allow some time for javascript code above to run before attempting to setup Comm Channel

I also noticed that occasionally a notebook on Binder will report this error so perhaps we should also somehow check that the code is running on a remote machine and increase the sleep time to a value greater than 1 .

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Tuesday, October 8, 2019 6:44:15 AM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

Hi Matt

I was able to run the all of the demo notebooks on Binder from the link you provided.

https://mybinder.org/v2/gh/vpython/vpython-jupyter/master?filepath=index.ipynb

which uses vpython version = ['7.5.2.beta1+9.gec99491', 'jupyter']

The first time you run a notebook then you will see the error you reported. But if you close the notebook and run it again then you will see that it works. All the other demo notebooks will then work on Binder.

I think that the problem occurs when you run the first notebook after Binder finishes launching is because we install vpython data to the nbextensions directory the first time you execute "from vpython import * " in a notebook. The installation is done in the file with_notebook.py and right after the copying of files to nbextensions we execute the glowcomm.js code. So there may be a timing issue causing the problem.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Tuesday, October 8, 2019 5:04:43 AM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

Hi Matt

I reproduced the problem on my local machine. The way I fixed it was to delete the vpython contents of the nbextensions directory on my machine. On my Windows computer the nbextensions directory is located at

AppData/Roaming/jupyter/nbextensions

In this nbextensions directory I deleted the file vpython_version, and the directories vpython_data and vpython_libraries.

Then when execute the line

from vpython import *

in a jupyter notebook then this data will be copied anew from the vpython package to the nbextensions directory.

We have some install logic to only copy these files over to nbextensions directory when there is a new release and not perform the copy every time the user imports vpython into a notebook. Since I updated the file vpython_libraries/glowcomm.js this file will only get installed properly if you bump up the vpython release number or delete the vpython data in nbextensions directory.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:59:07 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

Hi Matt

I am seeing this error also. I even see it if I create an new environment and install vpython 7.5.0 in that environment and run jupyter notebook from that environment. So I don't think it is from some recent vpython update since it happens with the last stable vpython release. Maybe it is something new from vpython dependency packages that get installed along with vpython.

John

From: "johncoady" johncoady@shaw.ca To: "vpython/vpython-jupyter" reply@reply.github.com Cc: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 9:12:47 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I have seen that error before and I found that if I save the notebook and close the notebook and then open it back up and try running the notebook again the error goes away. I have seen it on my local machine so I don't think it is a binder issue. Sometimes I try clear the browser data and the error goes away for me. Try doing some of these things and see if the error goes away for you.

John

From: "Matt Craig" notifications@github.com To: "vpython/vpython-jupyter" vpython-jupyter@noreply.github.com Cc: "johncoady" johncoady@shaw.ca, "Mention" mention@noreply.github.com Sent: Monday, October 7, 2019 8:13:17 PM Subject: Re: [vpython/vpython-jupyter] Binder error (#30)

I ran the Binary Star notebook (I like binary stars)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

mwcraig commented 5 years ago

Closing, since this now works