FranzMichaelFrank / health_eu

7 stars 3 forks source link

No module named 'plotly.io.json' #1

Open crkrenn opened 2 years ago

crkrenn commented 2 years ago

Hello,

I just tried running your app in a clean virtual environment, and got a "ModuleNotFoundError: No module named 'plotly.io.json'".

Because this was a problem in imported packages, simply removing the version numbers solved the problem, but this is probably not the best long-term solution.

Below are working and frozen versions of requirements.txt. Please let me know if you want help in testing any updated requirements.txt files.

Sincerely,

-Chris Krenn

Working requirements.txt:

jupyter
matplotlib
seaborn
pandas
numpy
dash
xlrd
openpyxl
plotly
kaleido
networkx
gunicorn
statsmodels

Frozen requirements.txt:

appnope==0.1.2
argon2-cffi==21.1.0
attrs==21.2.0
backcall==0.2.0
bleach==4.1.0
Brotli==1.0.9
cffi==1.15.0
click==8.0.3
cycler==0.11.0
dash==2.0.0
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
debugpy==1.5.1
decorator==5.1.0
defusedxml==0.7.1
entrypoints==0.3
et-xmlfile==1.1.0
Flask==2.0.2
Flask-Compress==1.10.1
fonttools==4.28.2
gunicorn==20.1.0
importlib-resources==5.4.0
ipykernel==6.5.1
ipython==7.29.0
ipython-genutils==0.2.0
ipywidgets==7.6.5
itsdangerous==2.0.1
jedi==0.18.1
Jinja2==3.0.3
jsonschema==4.2.1
jupyter==1.0.0
jupyter-client==7.1.0
jupyter-console==6.4.0
jupyter-core==4.9.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.2
kaleido==0.2.1
kiwisolver==1.3.2
MarkupSafe==2.0.1
matplotlib==3.5.0
matplotlib-inline==0.1.3
mistune==0.8.4
nbclient==0.5.9
nbconvert==6.3.0
nbformat==5.1.3
nest-asyncio==1.5.1
networkx==2.6.3
notebook==6.4.6
numpy==1.21.4
openpyxl==3.0.9
packaging==21.3
pandas==1.3.4
pandocfilters==1.5.0
parso==0.8.2
patsy==0.5.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.4.0
plotly==5.4.0
prometheus-client==0.12.0
prompt-toolkit==3.0.22
ptyprocess==0.7.0
pycparser==2.21
Pygments==2.10.0
pyparsing==3.0.6
pyrsistent==0.18.0
python-dateutil==2.8.2
pytz==2021.3
pyzmq==22.3.0
qtconsole==5.2.0
QtPy==1.11.2
scipy==1.7.2
seaborn==0.11.2
Send2Trash==1.8.0
setuptools-scm==6.3.2
six==1.16.0
statsmodels==0.13.1
tenacity==8.0.1
terminado==0.12.1
testpath==0.5.0
tomli==1.2.2
tornado==6.1
traitlets==5.1.1
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.2
widgetsnbextension==3.5.2
xlrd==2.0.1
zipp==3.6.0
EldhosePoulose commented 2 years ago

I did this

! pip install dash
! pip install dash-html-components
! pip install dash-core-components
! pip install plotly

import dash import dash_html_components as html import plotly.graph_objects as go import dash_core_components as dcc import plotly.express as px from dash.dependencies import Input, Output

It worked

EldhosePoulose commented 2 years ago

to test run this....

app = dash.Dash()

df = px.data.stocks()

app.layout = html.Div(id = 'parent', children = [ html.H1(id = 'H1', children = 'Styling using html components', style = {'textAlign':'center',\ 'marginTop':40,'marginBottom':40}),

    dcc.Dropdown( id = 'dropdown',
    options = [
        {'label':'Google', 'value':'GOOG' },
        {'label': 'Apple', 'value':'AAPL'},
        {'label': 'Amazon', 'value':'AMZN'},
        ],
    value = 'GOOG'),
    dcc.Graph(id = 'bar_plot')
])

@app.callback(Output(component_id='bar_plot', component_property= 'figure'), [Input(component_id='dropdown', component_property= 'value')]) def graph_update(dropdown_value): print(dropdown_value) fig = go.Figure([go.Scatter(x = df['date'], y = df['{}'.format(dropdown_value)],\ line = dict(color = 'firebrick', width = 4)) ])

fig.update_layout(title = 'Stock prices over time',
                  xaxis_title = 'Dates',
                  yaxis_title = 'Prices'
                  )
return fig  

if name == 'main': app.run_server()