Weave not works in remote Jupyter Lab

This might be a silly and somehow jupyter-related question (sorry in advanced if so), but couldn’t find solutions and appreciate if somebody helps.

I’m running Jupyter Lab with my local server in LAN(192.168.X.X) and access my notebooks from my Mac in the same LAN. Trying Weave Quickstart, Weave UI could not be rendered in a cell because “localhost refused to connect” (Chrome shows this, I guess)

In Jupyter Lab’s config, 192.168.X.X is bound (c.ServerApp.ip = '192.168.X.X').

I tried with Colaboratory too, it works. so, my Jupyter or server’s setting might be wrong, but I have no idea why triyng to access localhost(, which means my Mac)

Hello @kun432 !

This looks to be Jupyter Notebook struggling to connect to your server, not necessarily Weave that is having issue. Weave creates an IFrame so this is just a normal Jupyter Notebook output so I suspect it is something to do with your Jupyter instance. Does this error still show up if you restart the kernel as well as your Jupyter Instance?

Thanks for your reply. But restarting kernel does not solve.

checked IFrame’s URL and it’s like this:

http://localhost:36623/__frontend/weave_jupyter?(snip)

In my remote server, the port above is opend and bind to localhost,

$ ss -tan | grep "36623"
LISTEN     0      128        127.0.0.1:36623       0.0.0.0:*

and can access via curl inside the remote server.

$ curl http://localhost:36623
<!DOCTYPE html>
<!--
  We disable Google Translate because it does not play well with React 16
  See https://github.com/facebook/react/issues/11538
-->
<html lang="en" class="notranslate">
  <head>
    <!-- anti-flicker snippet for Google Optimize -->
(snip)
    <link rel="icon" href="/__frontend/favicon.ico" />
    <title>Weave Panel</title>
    <!-- See WeaveLoader.css for original source -->
    <style>
(snip)

I don’t know why this IFrame URL is bind to localhost.

Hello @kun432 !

Could you make non-Weave IFrames in your setup? This may have to do with hosting the server in LAN(192.168.X.X) and IFrame not being forwarding the IFrame to a LAN(192.168.X.X) rather than the localhost: URL like default JupyterLab Instances.

Thank you!

Trying with Plotly, which seems using IFrame too, and works OK.

Using Plotly, IFrame’s URL is like 192.168.X.X:8888/files/iframe_figures/figure_10.html?(snip). no problems.

Using Weave in my environment, there are 2 problems:

  • Weave seems always trying to bind IFrame’s URL to localhost
  • Weave seems always using a port randomly and also trying to bind the IP to localhost from the result of ‘ss’ command.

I see both Weave and Plotly uses IFrame but in different way to show their visuals so my trying above might means nothing. but as my guessing, If we use weave in Jupyter and Docker environment, this happens too, I guess.

Hello! I have been unable to replicate this on my end. I have been attempting to change my environment variables and setup to fit your and I think that I am missing something important. I will report this to the Weave team and see what they have to say about it.

1 Like

Hey @kun432, I’m taking over for Raph while he’s OOO. I just wanted to give you an update - our engineering team has eyes on this issue and I will update you when I know more.

1 Like

It worked for me after I port-forwarded the remote port being used for IFrame (port 32983) to my local in my case. Wonder if there’s a way to specify the port number in weave.

1 Like

@kun432 @shubhamgoel Our team just put out a PR for this that has been merged. Once there’s a new weave release, you should be able to update your Python weave package. Then, you’d need to set this env var like so prior to running your notebook:

WEAVE_FRONTEND_URL= http://192.168.X.X :XXXX jupyter notebook

2 Likes

Thank you for the prompt resolution. Looking forward to the next release!

1 Like

Thank you for great helps!

me, can’t wait for the next release, lol,
tried with the latest commit(d21717766e48eb38b4cd513ddb127d533454ac79) of main branch.
my procedures:

$ git clone https://github.com/wandb/weave
$  cd weave/
$ pip install -e .
$ WEAVE_FRONTEND_URL=http://192.168.XXX.XXX:8889 jupyter-lab --ip='0.0.0.0'

my notebook.

import weave
from sklearn.datasets import load_iris

# use any existing dataframe, here we load the iris data and visualize the labels
iris = load_iris(as_frame=True)
df = iris.data.assign(target=iris.target_names[iris.target])

weave.show_url(df)

URL is like http://192.168.XXX.XXX:8889/__frontend/weave_jupyter?fullScreen&expNode=. Great!

but accessing the URL, seems inifite redirect loop.

redirected URL is like this.

http://192.168.XXX.XXX:8889/oidc/login?redirect_to=http%3A%2F%2F192.168.XXX.XXXX%3A8889%2Foidc%2Flogin%3Fredirect_to%3Dhttp%253A%252F%252F192.168.XXX.XXX%253A8889%252Foidc%252Flogin%253Fredirect_to%253Dhttp%25253A%25252F%25252F192.168.XXX.XXX%25253A8889%25252Foidc%25252Flogin%25253Fredirect_to....(snip)

hope this might help.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.