Imports dont work? I have tried 3 tutorials for DASH and w/all 3 the import files dont work?

I have tried 3 tutorials and when I try the first file the imports error, I am now trying the step by step tutorial on the dash site/docs ( Part 2. Layout | Dash for Python Documentation | Plotly ) and when i follow the exact instructions the imports dont work. I have seen similiar problems on google/stack and everyone seems to say its due to dash.py, or some file naming issue, i opened 1 file in VS Code and copied and pasted the code straight from the dash tutorial on their site and it doesnt work. The instructions were create file app.py and copy and paste this code in below and run python app.py and all it does is error on the imports… unresolved import 'dash_core_components" unresolved imports 'dash_html_components" and unresolved imports plotly… I have tried 6 times to install, un install, in 3 different environments, trying 3 diffrent turorials and the same problem every time. I have been using python for a long time and not sure why this is happening but I only have 1 file in vs code named app.py…

-- coding: utf-8 --

Run this app with python app.py and

visit http://127.0.0.1:8050/ in your web browser.

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd

external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]

app = dash.Dash(name, external_stylesheets=external_stylesheets)

assume you have a “long-form” data frame

see Plotly Express Arguments | Python | Plotly 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 Python.
'''),

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

])

if name == ‘main’:
app.run_server(debug=True)

This doesn’t look like a dash problem persay, as there is the same error message for pandas.

How did you install the libraries?

Which editor are you using?

If you run python app.py in the terminal, do you see the same errors?

Ah I see you are using VSCode. Here is a resource that might help: Pylint “unresolved import” error in Visual Studio Code - iZZiSwift

(I found that by googling “vscode unresolved import python”)

Hi, Thanks but i tried ever one and it didnt work…

Not sure why but i have been using python for a long time w/vscode and none of my other files have this problem, only the ones with dash…

I think i fixed it! thx!

scratch that… none of it works, i thought it was fixed but then i get errros in the .json file… then i play with that and then the errors move back to the main file… and all the while nothing fires up…

I think im getting the hang of it, Thx