Issue Running in Pycharm Console

Hi, I’m trying to use the Pycharm debug console in order to run Dash apps. I’ve had success in the past while running Dash apps in the console, getting a result such as:

Dash is running on http://127.0.0.1:8050/

  • Serving Flask app ‘app’
  • Debug mode: on

This is what would be printed out when I select to “Run File in Python Console” through Pycharm.

I am currently setting up a brand-new system (without my old system to compare to), and running into an issue. When I run the following code;

# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.


from dash import Dash, html, dcc
import plotly.express as px
import pandas as pd

app = Dash(__name__)

# assume you have a "long-form" data frame
# see https://plotly.com/python/px-arguments/ for more options
df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]
})

fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A web application framework for your data.
    '''),

    dcc.Graph(
        id='example-graph',
        figure=fig
    )
])

if __name__ == '__main__':
    app.run(debug=True)

(this is just some basic boilerplate code from the plotly website).

Running this code in the console I get the following result:
<IPython.lib.display.IFrame at 0x1c75fbffe50>

The code terminates after printing out this one line. Running through the terminal or running in a Anaconda shell, I get the expected behavior of the code starting out as expected, but for some reason running in the console is giving me an issue. I haven’t gotten this issue running in the console in the past, so I believe there should be a way to fix it.

I am using the most up to date Dash version.

Hey @nshah_ft welcome to the forums.

Hard to tell, maybe the Pycharm version? I never had any problems with Pycharm, currently I’m using PyCharm 2022.2.1 (Community Edition).

No unfortunately not. I downgraded to this version but it still didn’t work. I’m curious what exactly is being printed?

<IPython.lib.display.IFrame at 0x1c75fbffe50>

The python code isn’t failing with any errors. I don’t really see any documentation on this type of “IFrame” so i’m confused what it could be.

Have you setup an interpreter for the app?

Hi, yes I have. I don’t believe the code would execute at all if there was no interpreter set up.

Hmm, perhaps trying again with a new interpreter, dont inherit anything.