-
Notifications
You must be signed in to change notification settings - Fork 1
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
Binder env not working for local COG #1
Comments
This is known/expected because of banesullivan/localtileserver#29 I do not know of a way to expose a server from the binder env that is accessible in the user's browser |
|
I was exploring the following repo this morning. It can run a streamlit web app on Binder. Not sure if it would be useful in your case. https://github.com/chekos/testing-streamlit-mybinder |
Ah, that demo is just what I needed to see! I will see if I can do something similar with localtileserver |
This is now working using # Set host forwarding for MyBinder
import os
# Make sure `notebooks.gesis.org/binder/jupyter/user/` matches your URL address
os.environ['LOCALTILESERVER_CLIENT_HOST'] = f"notebooks.gesis.org/binder/jupyter/user/{os.environ['JUPYTERHUB_USER']}" That HOST URL might change on different mybinder or jupyterhub deployments |
I just tested it on binder with the latest localtilesever. It does not seem to work. |
Make sure to use the --pre flag for pip as I only released a dev version for this 0.4.1.dev0 I want to double check things before doing an actual release |
Also, you'll need to install https://jupyter-server-proxy.readthedocs.io/en/latest/ and make sure its extensions are enabled |
Ignore the --pre flag comment. Just noticed you're installing from git |
This is what I tried with my leafmap binder. Still not working. Not sure what I did wrong. https://gishub.org/leafmap-binder
|
Your gesis binder works fine. So the issue is probably related to how the binder env is set up. Your uses docker, mine uses environment.yml |
I think you'll have to relaunch Jupyter after enabling the server extension Also make sure that code block at the top setting |
Yes, i did restart the kernel several times. Also uncommented that line. Still not working. Will look into it tomorrow. Thanks |
After uncommenting that line, make sure that value matches the URL in your browser |
Is this correct? if os.environ.get('JUPYTERHUB_USER'):
os.environ['LOCALTILESERVER_CLIENT_HOST'] = f"hub.gke2.mybinder.org/user/{os.environ['JUPYTERHUB_USER']}"
else:
os.environ['LOCALTILESERVER_CLIENT_PORT'] = '8888'
os.environ['LOCALTILESERVER_CLIENT_HOST'] = "127.0.0.0"
os.environ['LOCALTILESERVER_CLIENT_PREFIX'] = 'proxy/{port}' |
You need to set note that MyBinder's host can change anytime you launch, so |
Is there a way to retrieve the host URL programmatically? |
There's always a way! ....but I couldn't figure it out... 😞 The host is not listed in I tried: from notebook import notebookapp
servers = list(notebookapp.list_running_servers())
print(servers)
But there's another webserver on top that manages the traffic. I bet we could make a super hacky way of getting this through a custom ipython widget where the widget accesses This question might be something https://discourse.jupyter.org/c/binder/12 could help address |
ACTUALLY! I just found a much, much simpler way to do this. |
I will follow up in a PR in localtileserver |
See banesullivan/localtileserver#67 After that, the following should be sufficient: # Set host forwarding for MyBinder
import os
os.environ['LOCALTILESERVER_CLIENT_PREFIX'] = f"{os.environ['JUPYTERHUB_SERVICE_PREFIX'].lstrip('/')}/proxy/{{port}}" |
Fantastic! I can confirm that v0.4.3 works like a charm with Binder. How to make it work with other remote environments not using JupyterHub (e.g., streamlit)? # Set host forwarding for MyBinder
import os
os.environ['LOCALTILESERVER_CLIENT_PREFIX'] = f"{os.environ['JUPYTERHUB_SERVICE_PREFIX'].lstrip('/')}/proxy/{{port}}" |
Let's open a new issue in It should be a simple configuration with the settings I added for JupyterHub |
how to display raster image in remote environments, especially for streamlit? |
@wzp8023391 Unfortunately, localtileserver does not support streamlit. It is a streamlit problem rather than localtileserver. |
The binder env works well when rending a remote COG. However, it does not seem to work for a local COG (a file in the repo). The tile layer won't show up.
The text was updated successfully, but these errors were encountered: