plotly / dash-table

OBSOLETE: now part of https://github.com/plotly/dash
https://dash.plotly.com
MIT License
420 stars 72 forks source link

dash-table Quickstart example (verbatim) fails to run on current Python, pandas, Jupyter #691

Closed richlysakowski closed 4 years ago

richlysakowski commented 4 years ago

I followed the Dash QuickStart demonstration example verbatim from this dash github repo main page. The Dash QuickStart demonstration as provided does not run with current versions of supporting software.

I am bummed because I really needed this to work. The videos were so promising. The non-trivial examples almost never work as illustrated.

Here is the dash-table QuickStart source code that I used:

## Installation:  
pip install dash-table

# QuickStart code (verbatim):
import dash
import dash_table
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
    id='table',
    columns=[{"name": i, "id": i} for i in df.columns],
    data=df.to_dict("rows"),
)

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

Here's the output:

Running on http://127.0.0.1:8050/
Debugger PIN: 417-161-120
 * Serving Flask app "__main__" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

C:\ProgramData\Anaconda3\envs\my_hranalytics\lib\site-packages\IPython\core\interactiveshell.py:3339: UserWarning:

To exit: use 'exit', 'quit', or Ctrl-D.

Here's the traceback information:

%tb

---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
<ipython-input-28-5c560c1f5055> in <module>
      6 
      7 if __name__ == '__main__':
----> 8     app.run_server(debug=True)

C:\ProgramData\Anaconda3\envs\my_hranalytics\lib\site-packages\dash\dash.py in run_server(self, port, debug, dev_tools_ui, dev_tools_props_check, dev_tools_serve_dev_bundles, dev_tools_hot_reload, dev_tools_hot_reload_interval, dev_tools_hot_reload_watch_interval, dev_tools_hot_reload_max_retry, dev_tools_silence_routes_logging, dev_tools_prune_errors, **flask_run_options)
   1827             self.logger.info("Debugger PIN: %s", debugger_pin)
   1828 
-> 1829         self.server.run(port=port, debug=debug, **flask_run_options)

C:\ProgramData\Anaconda3\envs\my_hranalytics\lib\site-packages\flask\app.py in run(self, host, port, debug, load_dotenv, **options)
    988 
    989         try:
--> 990             run_simple(host, port, self, **options)
    991         finally:
    992             # reset the first request information if the development server

C:\ProgramData\Anaconda3\envs\my_hranalytics\lib\site-packages\werkzeug\serving.py in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context)
   1048         from ._reloader import run_with_reloader
   1049 
-> 1050         run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
   1051     else:
   1052         inner()

C:\ProgramData\Anaconda3\envs\my_hranalytics\lib\site-packages\werkzeug\_reloader.py in run_with_reloader(main_func, extra_files, interval, reloader_type)
    337             reloader.run()
    338         else:
--> 339             sys.exit(reloader.restart_with_reloader())
    340     except KeyboardInterrupt:
    341         pass

SystemExit: 1

################################### VERSION INFORMATION:

Google Chrome is up to date: Version 80.0.3987.106 (Official Build) (64-bit)

Jupyter Notebook Server Information: The version of the notebook server is: 6.0.3 The server is running on this version of Python: Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]

Current Kernel Information: Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

Here's the Pandas version information that shows many other packages' versions that are installed:

pd.show_versions()

INSTALLED VERSIONS
------------------
commit           : None
python           : 3.7.6.final.0
python-bits      : 64
OS               : Windows
OS-release       : 10
machine          : AMD64
processor        : Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
byteorder        : little
LC_ALL           : None
LANG             : None
LOCALE           : None.None

pandas           : 1.0.1
numpy            : 1.18.1
pytz             : 2019.3
dateutil         : 2.8.1
pip              : 20.0.2
setuptools       : 45.1.0.post20200127
Cython           : None
pytest           : None
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : 4.5.0
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : 2.11.1
IPython          : 7.12.0
pandas_datareader: 0.8.1
bs4              : None
bottleneck       : None
fastparquet      : None
gcsfs            : None
lxml.etree       : 4.5.0
matplotlib       : 3.1.3
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : None
pytables         : None
pytest           : None
pyxlsb           : None
s3fs             : None
scipy            : 1.4.1
sqlalchemy       : None
tables           : None
tabulate         : None
xarray           : None
xlrd             : None
xlwt             : None
xlsxwriter       : None
numba            : None

I verified that all of the requirements were met by reinstalling them, restarting the Jupyter Python kernel, and then re-running the Quickstart code.

dash.version '1.4.1'

dash_table.package

{'name': 'dash-table', 'version': '4.4.1', 'description': 'Dash table', 'repository': {'type': 'git', 'url': 'git@github.com:plotly/dash-table.git'}, 'bugs': {'url': 'https://github.com/plotly/dash-table/issues'}, 'homepage': 'https://github.com/plotly/dash-table', 'main': 'dash_table/bundle.js', 'scripts': {'preprivate::opentests': 'run-s private::wait', 'preprivate::test.server': 'run-s private::wait_dash', 'preprivate::test.standalone': 'run-s private::wait_js', 'pretest.standalone': 'run-s private::build:js-test', 'private::build': 'node --max_old_space_size=4096 node_modules/webpack/bin/webpack --display-reasons --bail', 'private::build:js': 'run-s "private::build -- --mode production"', 'private::build:js-dev': 'run-s "private::build -- --mode development --config webpack.dev.config.js"', 'private::build:js-test': 'run-s "private::build -- --mode development --config webpack.test.config.js"', 'private::build:js-test-watch': 'run-s "private::build -- --mode development --config webpack.test.config.js --watch"', 'private::build:py': "dash-generate-components src/dash-table/dash/DataTable.js dash_table -p package-info.json && cp dash_table_base/ dash_table/ && dash-generate-components src/dash-table/dash/DataTable.js dash_table -p package-info.json --r-prefix 'dash'", 'private::host_dash8081': 'python tests/cypress/dash/v_be_page.py', 'private::host_dash8082': 'python tests/cypress/dash/v_copy_paste.py', 'private::host_dash8083': 'python tests/cypress/dash/v_fe_page.py', 'private::host_dash8084': 'python tests/cypress/dash/v_data_loading.py', 'private::host_dash8085': 'python tests/cypress/dash/v_default.py', 'private::host_dash8086': 'python tests/cypress/dash/v_pagination.py', 'private::host_js': 'http-server ./dash_table -c-1 --silent', 'private::lint:ts': 'tslint --project tsconfig.json --config tslint.json', 'private::lint:py': 'flake8 --exclude=DataTable.py,init.py,imports.py dash_table', 'private::wait_dash8081': 'wait-on http://localhost:8081', 'private::wait_dash8082': 'wait-on http://localhost:8082', 'private::wait_dash8083': 'wait-on http://localhost:8083', 'private::wait_dash8084': 'wait-on http://localhost:8084', 'private::wait_dash8085': 'wait-on http://localhost:8085', 'private::wait_dash8086': 'wait-on http://localhost:8086', 'private::wait_js': 'wait-on http://localhost:8080', 'private::opentests': 'cypress open', 'private::test.python': 'python -m unittest tests/unit/format_test.py', 'private::test.unit': "cypress run --browser chrome --spec 'tests/cypress/tests/unit//*'", 'private::test.server': "cypress run --browser chrome --spec 'tests/cypress/tests/server/*/'", 'private::test.standalone': "cypress run --browser chrome --spec 'tests/cypress/tests/standalone/*/'", 'build.watch': 'webpack-dev-server --content-base dash_table --mode development --config webpack.dev.config.js', 'build': 'run-s private::build:js private::build:py', 'format': 'run-s "private::lint:ts -- --fix"', 'lint': 'run-s private::lint:', 'test.server': 'run-p --race private::host private::test.server', 'test.standalone': 'run-p --race private::host_js private::test.standalone', 'test.unit': 'run-s private::test.python private::test.unit', 'test.visual': 'build-storybook && percy-storybook', 'test.visual-local': 'build-storybook', 'test.watch': 'run-p --race "private::build:js-test-watch" --race private::host private::opentests'}, 'author': 'Chris Parmer chris@plot.ly', 'maintainer': 'Ryan Patrick Kyle ryan@plot.ly', 'license': 'MIT', 'dependencies': {}, 'devDependencies': {'@babel/cli': '^7.6.2', '@babel/core': '^7.6.2', '@babel/polyfill': '^7.6.0', '@babel/preset-env': '^7.6.2', '@babel/preset-react': '^7.0.0', '@cypress/webpack-preprocessor': '^4.1.0', '@fortawesome/fontawesome-svg-core': '^1.2.25', '@fortawesome/free-regular-svg-icons': '^5.11.2', '@fortawesome/free-solid-svg-icons': '^5.11.2', '@fortawesome/react-fontawesome': '^0.1.4', '@percy/storybook': '^3.2.0', '@storybook/cli': '^5.1.11', '@storybook/react': '^5.1.11', '@types/d3-format': '^1.3.1', '@types/papaparse': '^5.0.1', '@types/ramda': '^0.26.21', '@types/react': '^16.9.2', '@types/react-dom': '^16.9.0', '@types/react-select': '^1.3.4', 'babel-loader': '^8.0.6', 'core-js': '^3.2.1', 'css-loader': '^3.2.0', 'cypress': '^3.4.1', 'd3-format': '^1.4.1', 'fast-isnumeric': '^1.1.3', 'file-loader': '^4.2.0', 'http-server': '^0.11.1', 'less': '^3.10.3', 'less-loader': '^5.0.0', 'npm': '^6.11.3', 'npm-run-all': '^4.1.5', 'papaparse': '^5.1.0', 'ramda': '^0.26.1', 'raw-loader': '^3.1.0', 'react': '16.9.0', 'react-docgen': '^4.1.1', 'react-dom': '16.9.0', 'react-select': '^1.3.0', 'remarkable': '^2.0.0', 'sheetclip': '^0.3.0', 'style-loader': '^1.0.0', 'ts-loader': '^6.2.0', 'tslint': '^5.20.0', 'typescript': '^3.6.3', 'wait-on': '^3.3.0', 'webpack': '^4.41.0', 'webpack-cli': '^3.3.9', 'webpack-dev-server': '^3.8.1', 'webpack-preprocessor': '^0.1.12', 'xlsx': '^0.15.1'}, 'files': ['/dash_table/bundle{.js,.map}'], 'peerDependencies': {'prop-types': '^15.7.2', 'react': '>=0.14', 'react-dom': '>=0.14'}, 'engines': {'node': '>=8.11.0', 'npm': '>=6.1.0'}}

chriddyp commented 4 years ago

@richdevboston - I believe this is an issue with Jupyter and Flask's reloader, originally reported https://github.com/plotly/dash/issues/34. Try doing run_server(debug=False)