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

Asset registration doesn't work with a remote Jupyter server #10

Open
joshuamanns opened this issue Apr 5, 2019 · 11 comments
Open

Asset registration doesn't work with a remote Jupyter server #10

joshuamanns opened this issue Apr 5, 2019 · 11 comments

Comments

@joshuamanns
Copy link

joshuamanns commented Apr 5, 2019

When using a library like Interact that relies on AssetRegistry on a remote Jupyter server, 404s are thrown for assets.
See this thread: JuliaGizmos/Interact.jl#270

@shashi
Copy link
Member

shashi commented Apr 5, 2019

Thanks for the issue! @travigd you needed to solve this problem too right?

One idea which can potentially work: I believe there's only a ZMQ link between the kernel and the Jupyter server. So we can make our plugin serve files by fetching them via ZMQ instead of directly reading from disk. IMO this is still much better / proper than trying to send files over WebSocket by writing some Julia code.

@twavv
Copy link
Member

twavv commented Apr 5, 2019

@shashi This is a little bit different than what I was talking about (which is running a Jupyter kernel on a remote server rather than the entire notebook/lab server).

At any rate, are you using JupyterHub? What is the url of your notebook and what URL is the AssetRegistry using (i.e. what URL do you see 404 errors for in the browser console)?

@shashi
Copy link
Member

shashi commented Apr 12, 2019

Oh I assumed "server" means kernel in the issue title...

@twavv
Copy link
Member

twavv commented Apr 13, 2019

Yeah, remote kernel (insofar as remote to the web server) is a pretty rare case as far as I know. The only common case is "enterprise" kernels (i.e. things that run on clusters like Spark).

@joshuamanns Are you still having issues?

@ilanpillemer
Copy link

ilanpillemer commented Oct 13, 2020

I am having this issue

URL of notebook : https:///jupyter/user/ilan.pillemer@@dev/lab/workspaces/auto-0
URL of 404 : https:///jupyter/user/ilan.pillemer@@dev//assetserver/ced635b163795d11ca32b58b98ce168337af879a-style.css

@twavv
Copy link
Member

twavv commented Oct 14, 2020

Is it the double-slash that's causing the issue? I've not had these kinds of issues on JupyterHub myself.

@ilanpillemer
Copy link

ilanpillemer commented Oct 15, 2020

when I tried removing the double slash and pasting into the url bar, it still didnt give me the css file.

$ echo $JUPYTERHUB_SERVICE_PREFIX

/jupyter-dev/user/ilan.pillemer<snipped>/

$ echo $JULIA_ASSETREGISTRY_BASEURL

$ echo $ENV

$

So the double slash is caused because JUPYTERHUB_SERVICE_PREFIX has a trailing slash.
According to this jupyterhub/jupyterhub#997 its always meant to have a trailing slash if it exists.

But when I simply tried pasting the URL without the double slash it still seemed to not work.
So I think its definitely part of the problem, but maybe not all of the problem.

Do you know how I can diagnose to see what the URL it is expecting should be? ie where the asset server is running on?
If you tell me how to diagnose further so we can get the bottom of it and get this working, I will use those steps to diagnose and analyse. But I am unsure how to determine what the expected URL should be. I am new to Julia so may need some guidance on how to override values etc, to see if different changes will solve the problem.

by the way this is from a regular notebook, the above comment a day or so ago was trying to get it working in JupyterLab. But the same thing happens in both.

@twavv
Copy link
Member

twavv commented Oct 15, 2020

Is WebIO pre-installed on the server?

The assetregistry extension is a Jupyter server extension, which needs to be installed before the Jupyter notebook instance starts (there's no way to activate it after the Jupyter notebook has started).

@ilanpillemer
Copy link

ilanpillemer commented Oct 15, 2020

Currently I run from the notebook. (in the Jupyter Hub)

using Plots
using Interact
using WebIO
WebIO.install_jupyter_nbextension

or alternatively the lab extension.

and then restart the kernel.

currently I believe we use this to start-up the Julia kernel in the k8s cluster as part of Jupyter Hub running the K8s cluster.

RUN julia -e 'import Pkg; Pkg.update()' && \
    (test $TEST_ONLY_BUILD || julia -e 'import Pkg; Pkg.add("HDF5")') && \
    julia -e "using Pkg; pkg\"add IJulia\"; pkg\"precompile\""

I would assume we would need to change this to include WebIO and Interact. Any suggestion on the best way to do that? FYI @dbricare

@twavv
Copy link
Member

twavv commented Oct 15, 2020

Yep, just add WebIO and run WebIO.install_jupyter_nbextension() as part of that same run.

RUN julia -e 'import Pkg; Pkg.update()' && \
    (test $TEST_ONLY_BUILD || julia -e 'import Pkg; Pkg.add("HDF5")') && \
    julia -e '\
        using Pkg; pkg"add IJulia WebIO"; pkg"precompile"; \
        using WebIO; WebIO.install_jupyter_nbextension(); \
    '

@ilanpillemer
Copy link

that made all the difference.

image

However I still needed to run the below in the notebook and then type CMD-R.. but after that it worked 🎉

Anyway to avoid having to do that?

using WebIO
WebIO.install_jupyter_nbextension

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

4 participants