Bokeh Standalone (No Server) suddenly stopped rendering Datatables .
Error - “Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing”
Link - Datatable_Error.html
Tried Importing bokeh.min.js using both INLINE and CDN.
Code:
from bokeh.resources import INLINE, CDN
from bokeh.io import output_file, save
from bokeh.models import ColumnDataSource, DataTable, TableColumn
from bokeh.layouts import layout
import pandas as pd
import numpy as np
np.random.seed(42)
df = pd.DataFrame({
'ID': range(1, 51),
'Name': [f'Item {i}' for i in range(1, 51)],
'Category': np.random.choice(['A', 'B', 'C'], size=50),
'Price': np.round(np.random.uniform(10, 100, size=50), 2),
'Quantity': np.random.randint(1, 20, size=50)
})
print(df.shape)
print(df.head(1))
print(df.tail(1))
source = ColumnDataSource(df)
columns = [TableColumn(field=col, title=col) for col in df.columns]
data_table = DataTable(source=source, columns=columns, sizing_mode='stretch_both')
tableLayout = layout([[data_table]])
_df_htmlpath = "secondTerminal.html"
output_file(_df_htmlpath)
save(tableLayout)
save(tableLayout, filename=_df_htmlpath , resources=INLINE)
# save(tableLayout, filename=_df_htmlpath , resources=CDN)