question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to run jupyter dash in Google Colab

See original GitHub issue

I would like to run jupyter-dash in google colab. However, it is not possible to do so based on the example notebook.

Running the notebook I get a blank iframe.

image

When I followed the steps for embedding iframe of a flask app into colab notebook described at: https://stackoverflow.com/questions/54465816/how-to-use-flask-in-google-colaboratory-python-notebook

I get empty charts:

image

If I rerun the app without the mode="inline" I get the following error messages:

image

import IPython.display

def display_iframe(port, height):
    shell = """
        (async () => {
            const url = await google.colab.kernel.proxyPort(%PORT%, {"cache": true});
            console.log(`Adding ifram from URL:${url}`);
            const iframe = document.createElement('iframe');
            iframe.src = url;
            iframe.setAttribute('width', '100%');
            iframe.setAttribute('height', '%HEIGHT%');
            iframe.setAttribute('frameborder', 0);
            document.body.appendChild(iframe);
        })();
    """
    replacements = [
        ("%PORT%", "%d" % port),
        ("%HEIGHT%", "%d" % height),
    ]
    for (k, v) in replacements:
        shell = shell.replace(k, v)

    script = IPython.display.Javascript(shell)
    IPython.display.display(script)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Nnamdi-syscommented, Jan 29, 2022

Colab support added in #27 and released in version 0.3.0

It doesn’t still work in Colab.

Gives the following error: AttributeError: (‘Read-only: can only be set in the Dash constructor or during init_app()’, ‘requests_pathname_prefix’)

1reaction
jonmmeasecommented, Jul 24, 2020

Colab support added in https://github.com/plotly/jupyter-dash/pull/27 and released in version 0.3.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Launch a Dash app in a Google Colab Notebook
unzip ngrok-stable-linux-amd64.zip ### Run ngrok to tunnel Dash app port 8050 to the outside world. ### This command runs in the background.
Read more >
Share your Dash App on Google Colab and Kaggle - YouTube
Learn how to put your Dash Plotly app onto Google Colab and Kaggle, using Jupyter Dash. ... Your browser can't play this video....
Read more >
Setting up Plotly Dash in JupyterLab & Jupyter Notebook
In this tutorial you'll learn to set up Jupyter Lab and Jupyter Notebook to run your Plotly Dash Apps, using PC or Mac....
Read more >
16 Running Dash Apps - Introduction to Google Colab for ...
Introduction to Google Colaboratory for Research - 16 Running Dash Apps00:00:00 Introduction00:00:17 Dash Framework00:00:43 Jupyter ...
Read more >
Problem running Dash in Google Colab notebook
I'm new to Plotly and am trying to use Dash. I found some sample code in an online tutorial and have tried to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found