Set canvas to non-localhost address while in an IPython Notebook

User 2151 | 8/7/2015, 4:53:09 PM

I like the web-based canvas visualizations/navigation: But I'm running an IPython/ GraphLab notebook from a VM server.

I've tried both




And while the "Canvas is accessible via web browser at the URL: http://localhost:XXXXX"

It simply loads within the VM (it never gets served out to server-ip:XXXXX)

Thoughts/Suggestions appreciated.


User 1359 | 8/7/2015, 5:30:27 PM


You are correct using the second line in your post:

gl.canvas.set_target('headless', port=#####) where ##### is a port number higher than 1024

A couple things to check:

  1. The interface binds to only the localhost interface intentionally, to prevent data leakage. To access the Canvas server remotely, create an ssh tunnel from your local machine to the server:

    ssh -L <port>:localhost:<port> remote.server

    and open the browser to http://localhost:(port)/index.html

  2. Have you called .show() on a GLC object? Canvas can also be used to do this, though there will be no visual displays. or

    sf= gl.SFrame({'a':[1,2,3],'b':[4,5,6]})

  3. The URL specifically requires the "/index.html" at the end. http://server-ip:port/index.html

More information can be found at:

Cheers, Dick

User 2151 | 8/26/2015, 5:09:27 AM

Hey Dick, Thanks for the suggestions - I believe we chatted a bit at the Dato conference!

So my work around - since I'm hosting Dato on a VM that's exposed only on our private network was to do something like this:

sudo sysctl -w net.ipv4.conf.all.route_localnet=1
sudo iptables -t nat -I PREROUTING -p tcp --dport XYZ -j DNAT --to

Where: 1. XYZ is the outward facing port I'll connect to * e.g. http://servername:XYZ/index.html 2. ##### matches the port defined in canvassettarget * e.g. gl.canvas.set_target('headless', port=#####)

User 1359 | 8/31/2015, 5:58:54 PM

Thanks for the update!

In this case, you are forwarding the localhost:<port> connection on the server side to an external-facing interface.

It is good that you have privacy on your network. You should not experience data security issues in that case.