ginga
ginga copied to clipboard
Start viewer server OSError: [Errno 99] Cannot assign requested address (Google Colab)
Dear community,
I´m trying to replicate the example ginga_ipython_demo.ipynb in a Google Collab Notebook. However, when executing the code line ``, I get the following error.
Any assitance would be highly appreciated. It may be due to the fact that I'm running the notebook in Google's platform as opposed to in a "local" (ie in my computer) Jupyter server.
Kind Regards Jose
@jortiz12, I just tested the notebook locally, and it is still valid. I suspect the collab environment may restrict opening ports in some way? In any case, the port number can be changed in the second cell of the notebook. Try changing it from the default of 9914 and let us know the result.
First, thanks for your time and attention.
The issue doesn´t lie in the port number line of code server = ipg.make_server(host='localhost', port=8888, use_opencv=use_opencv),
as I changed it from 9914 to 8888 (Jupyter default).
The error continus to appear when running server.start(no_ioloop=True).
I don't think this is Ginga's problem. See https://stackoverflow.com/questions/69880285/receive-oserror-errno-99-cannot-assign-requested-address-on-google-colab
Thanks pllim,
Indeed, indeed. That's also my opinion. The issue is that as I'm working with very large IFS MUSE datacubes , my local machine hasn´t enough RAM. Hence, I've to make use of Google Cloud Platfrom.
I was simpy trying to use GINGA in such notebook in Google Colab as although I've the DS9 viewer opened, Google Colab doesn't "know" of its existance. Nor does of Ginga it seems.
Thxs again. jose
@jortiz12 , just to make sure, did the StackOverflow solution work for you?
No bcse that solution applies to a Jupyter-based notebook, not to a notebook in Google Colab. I can also confirm tat GINGA is wking perfctly well in my "local" Jupyter. The issue is when you use Google Colab notebooks.
Txs again for the attention.
I am not sure what can be done in the Colab world. It seems to still be stuck in Python 3.7 while packages have moved on. @ejeschke , any ideas?
Thinking about this a little more deeply, I think there are two issues. The first is that probably we need to replace "localhost" with the hostname or IP of the google collab host where the notebook is actually running. For that, I think you might want to look at this video. That is simple enough. @jortiz12, please try that first and then report back here.
The second potential issue is whether you are allowed to open a port on the collab server that is open to your browser on your laptop (or wherever). You may need to tunnel the connection. I've seen a couple links on that, but let's see about the first issue before going there.
So I tried running this notebook on Google Collab. Using the following, it does not give me an error trying to start the server:
import socket
hostname = socket.gethostname()
ipaddr = socket.gethostbyname(hostname)
then replace "localhost" with ipaddr.
However, there is then (I think) the second issue of how to tunnel to that connection, because I think it is walled off. I'm looking that that now. It seems to be a known issue with no real support from google. However, a lot of tutorials related to this issue seem to be using a package called pyngrok
. Looking into that now...
Just a note for the sake of completeness, I tried the Ginga Jupyter Widgets backend. It displays in Google Colab, but since ipyevents
does not seem to be supported there, I could not get any interactivity with the widget. @mwcraig, do you have any experience getting ipyevents
working in Google Colab?
Hello @ejeschke @pllim,
Your first advice, changing the hostname, indeed has worked for me!!.
It was just a matter of replacing the line server = ipg.make_server(host='localhost', port=8888, use_opencv=use_opencv)
to server = ipg.make_server(host=hostname, port=8888, use_opencv=use_opencv)
, where hostname can be found with:
import socket
hostname = socket.gethostname()
IPAddress = socket.gethostbyname(hostname)
print("my host computer name is " + hostname)
print("my host computer IP Address is " + IPAddress)
Thks so much. Much appreciated. Kind Rgds Jose
Hello again,
Well, I was too quick in saying that the problem had been solved.
Though by changing the localhost to Google's server hostname, as noted above, the line of code v1 = server.get_viewer('v1')
didn´t resulted in any error, when I copy the URL from the output of v1.url
and copy it into my browser, it can´t be found ...
Yes, that mirrors my result above. I think Collab doesn't want to open any ports to the world unless it can be tunneled somehow.
Instead of Collab, let's step back and maybe you should ask the data provider if they have a proper science platform you can use...
Thxs @ejeschke and @pllim Indeed, and I'll continue to work with the less "heavy" data in my local Jupyter. Best rgds Jose
@mwcraig, do you have any experience getting ipyevents working in Google Colab?
I haven't tried -- my experience with colab was mixed the last time I looked at it so I've never really tried. ipyevents
only uses the standard widget communications channel but I have no idea how how google modified that channel to get widgets working.
@mwcraig, do you have any experience getting ipyevents working in Google Colab?
I haven't tried -- my experience with colab was mixed the last time I looked at it so I've never really tried.
ipyevents
only uses the standard widget communications channel but I have no idea how how google modified that channel to get widgets working.
It seems like they have modified something, because ipyevents
still works fine in a local notebook, but I can't get any events coming through running it on Colab: mouse, keyboard, scrolling...anything
It's too bad, because that would be the way to go, IMHO--no need to tunnel anything.