Bokeh3.8.0 -" Datatable - BokehJS library is missing"

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)

@srt111 Your example works for me if I remove sizing_mode='stretch_both' from the DataTable. Could be a bug, I’d suggest opening a GitHub Issue.

Edit: to be clear though, I am not seeing any error like:

Error - “Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing”

with Bokeh 3.8 on OSX. Are there any other errors e.g. in your browsers network or scripts tabs?

1 Like

Open the bokeh output html file in a text editor .

In the javascript section it will show BokehJs library missing error (here)

I’m sorry I don’t understand what you are suggesting. Bokeh standalone output is HTML+JS that requires viewing in a browser, not a text editor. Please be much more specific about exactly what platform, tools, and steps you are taking.