Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use on Google Colab? #3

Open
cmdcolin opened this issue Apr 22, 2024 · 4 comments
Open

Use on Google Colab? #3

cmdcolin opened this issue Apr 22, 2024 · 4 comments

Comments

@cmdcolin
Copy link

Hello:)
It is great to see this project.

I was trying to see if it worked on Google Colab but it seemed to give an error
screenshot

image

ERROR:    [Errno 99] error while attempting to bind on address ('::1', 43081, 0, 0): cannot assign requested address

is this expected? i was interested in the servir code cause that worked seemlessly locally in the jupyter lab notebook

@cmdcolin
Copy link
Author

random other note: i think this repo is missing a license

@manzt
Copy link
Owner

manzt commented Apr 22, 2024

is this expected? i was interested in the servir code cause that worked seemlessly locally in the jupyter lab notebook

Thanks. This should be working. I ran into it the other day and wonder if Colab has changed something. Ideally, we would use anywidget to send the data but servir is a quick workaround to expose a background webserver to the client. However, as you are noticing, there are more issues that arise with this due to a need to separately configure the web sever for different environments. "easy" locally, and a nightmare for "remote" Jupyter/Colab.

If we used the Jupyter websocket (via anywidget), we could reuse this channel for better consistency across all environments.

random other note: i think this repo is missing a license

oops, just added. Thanks for pointing this out!

@manzt
Copy link
Owner

manzt commented Apr 22, 2024

For context, Google Colab (historically) has used a Service Worker in the front end to authenticate and proxy HTTP requests to http://localhost in the google notebook to the backend kernel. This behavior is not documented and I'm guessing there is some change.

Update: I'm able to get servir working by starting the Provider on host=0.0.0.0 but then the URL provided to the front-end needs to be localhost to hook into the Service Worker behavior. Here's a hacky workaround, but range-requests don't seem to be working.

!pip install --quiet pygv
!wget https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/UCSC.HG38.Human.CytoBandIdeogram.bed
import pygv

pygv._api._PROVIDER.start(host="0.0.0.0") # start background server on `0.0.0.0` instead of `localhost`

pygv.ref("hg38")
pygv.locus("chr1")
track = pygv.track("UCSC.HG38.Human.CytoBandIdeogram.bed")
track.url = track.url.replace("0.0.0.0", "localhost") # change URL given by servir to `localhost` for front end 🙄
pygv.browse(track)

More in-depth discussion: higlass/higlass-python#144

@cmdcolin
Copy link
Author

excellent, thanks for checking that out! I am really curious what something like #1 could look as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants