openPMD/openPMD-viewer

running on colab

Closed this issue · 3 comments

Hi, Is it possible to run openPMD on google colab?

after installation when I type !openPMD_notebook it gets error:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/traitlets/config/application.py", line 845, in launch_instance
    app.initialize(argv)
  File "/usr/local/lib/python3.7/dist-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/notebook/notebookapp.py", line 1537, in initialize
    self.init_webapp()
  File "/usr/local/lib/python3.7/dist-packages/notebook/notebookapp.py", line 1321, in init_webapp
    self.http_server.listen(port, self.ip)
  File "/usr/local/lib/python3.7/dist-packages/tornado/tcpserver.py", line 143, in listen
    sockets = bind_sockets(port, address=address)
  File "/usr/local/lib/python3.7/dist-packages/tornado/netutil.py", line 168, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address

Hi,
I haven't tried yet, but I can see no reason why it shouldn't work. The issue you are seeing is that the command openPMD_notebook is meant to be run from a terminal. It will copy a template notebook file and launch a jupyter server. On colab you are running already within a notebook I assume. So there is no need to launch jupyter. You can just import openpmd-viewer via from openpmd_viewer import OpenPMDTimeSeries.

You can find the template notebook here and just copy the contents to you colab notebook.

Note that you might have to enable ipywidgets on colab as shown here in order to get the interactive plotting tool working.

yes your wright! It was a misunderstanding from me!
and good news is openPMD correctly work in colab:)
thanks!

Great!