Troubleshooting#
ITables tables are interactive, but that requires JavaScript to actually run in whatever is displaying the notebook. When it can’t, you will see one of two things instead: a table stuck on “Loading ITables…”, or, since ITables v2.9, a small static preview. This page explains both, and how to get the interactive table back
when that is possible.
Stuck on “Loading ITables…”?#
This means your browser can run JavaScript, but the DataTables library that ITables relies on was never loaded. The most likely causes are:
You forgot to run
init_notebook_mode()(like in the example above), or you deleted that cell or its output.You ran
init_notebook_mode(connected=True)but you are not connected to the internet, so the library cannot be fetched.
Tip
If you change the value of the connected argument in
the init_notebook_mode cell, you need to re-execute all the cells
that display interactive tables.
Seeing a static preview instead?#
If, instead of “Loading…”, you see non-interactive table, then
JavaScript could not run at all where that table is being rendered -
your browser was never given the chance to load anything. In that case, ITables v2.9+ falls back to a static preview: a plain HTML (or, when printed
by itables.show() outside of a notebook, Markdown) table with only the
first rows - 10 by default, or as many as your pageLength/lengthMenu
options say. This lets you check the table content, but you can’t sort,
search or paginate it. Here is what that plain HTML table looks like:
from IPython.display import HTML, display
df = itables.sample_dfs.get_countries()
display(HTML(itables.to_html_static_preview(df)))
| ⓘ | region | country | capital | longitude | latitude |
|---|---|---|---|---|---|
| code | |||||
| AW | Latin America & Caribbean | Aruba | Oranjestad | -70.016700 | 12.516700 |
| AF | South Asia | Afghanistan | Kabul | 69.176100 | 34.522800 |
| AO | Sub-Saharan Africa | Angola | Luanda | 13.242000 | -8.811550 |
| AL | Europe & Central Asia | Albania | Tirane | 19.817200 | 41.331700 |
| AD | Europe & Central Asia | Andorra | Andorra la Vella | 1.521800 | 42.507500 |
| AE | Middle East & North Africa | United Arab Emirates | Abu Dhabi | 54.370500 | 24.476400 |
| AR | Latin America & Caribbean | Argentina | Buenos Aires | -58.417300 | -34.611800 |
| AM | Europe & Central Asia | Armenia | Yerevan | 44.509000 | 40.159600 |
| AS | East Asia & Pacific | American Samoa | Pago Pago | -170.691000 | -14.284600 |
| AG | Latin America & Caribbean | Antigua and Barbuda | Saint John's | -61.845600 | 17.117500 |
| (198 more rows not shown) | |||||
There are two situations where this happens, and only one of them can be fixed:
You can fix it: the notebook you’re viewing is not trusted. This happens when you have not run the notebook in full yourself - e.g. it was sent to you with outputs, or it was created by a tool like
papermill. Tell Jupyter that you trust it (run “Trust Notebook” in View / Activate Command Palette), and the interactive table will appear.You can’t fix it: you are looking at a static rendering of the notebook, such as GitHub’s preview of an
.ipynbfile. There, JavaScript never runs, no matter how the notebook was created or trusted, so the static preview is all you will ever see on that page. Open the notebook in an actual, JavaScript-capable Jupyter session to get the interactive table. See static_preview_demo.ipynb for a live example of both.
Check ITables’ version#
If the above does not help, please check out the ChangeLog
and decide whether you should upgrade itables. You can tell the version
of ITables that you are using by looking at the loading message (from ITables v2.0.1 on)
or by running this code snippet:
import itables
itables.__version__
'2.9.0'