cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results for 
Search instead for 
Did you mean: 

Statsmodel OLS.fit generates "Error displaying widget: undefined"

JU1
New Contributor III

Hi,

I am running some code which fits a linear model via Statsmodel. Everytime I run the .fit function it generates the error: "Error displaying widget: undefined".

I can reproduce the error via the simple code below.

I am not sure what is causing this issue and I cannot find any similar issues online. Is anybody aware of the issue causing this error?

Node type: Standard_DS3_v2

Databricks runtime version: 15.1 ML

Statsmodel version: 0.14.0

 

import statsmodels.api as sm
import pandas as pd

# Create sample data
data = {
    "X": [1, 2, 3, 4, 5],
    "Y": [2, 4, 5, 4, 5]
}

df = pd.DataFrame(data)

# Define independent and dependent variables
X = sm.add_constant(df["X"])  # Add constant for intercept
y = df["Y"]

# Fit OLS model
model = sm.OLS(y, X).fit()
 
 
JU1_0-1738313760137.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @JU1,

The issue is likely related to an issue with the ipywidgets library, which is used for rendering interactive widgets in Jupyter notebooks. This issue has been observed in compatibility problems between different versions of ipywidgets and other libraries.

Can you run this command and send the output?

import ipywidgets as widgets
print(widgets.__version__)

Also can you try on another DBR version like 14.3

View solution in original post

JU1
New Contributor III

Hi,

It was indeed the DBR which caused the issue. I changed it to 16.1 and the widgets now load.

Thanks

View solution in original post

3 REPLIES 3

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @JU1,

The issue is likely related to an issue with the ipywidgets library, which is used for rendering interactive widgets in Jupyter notebooks. This issue has been observed in compatibility problems between different versions of ipywidgets and other libraries.

Can you run this command and send the output?

import ipywidgets as widgets
print(widgets.__version__)

Also can you try on another DBR version like 14.3

JU1
New Contributor III

Hi,

It was indeed the DBR which caused the issue. I changed it to 16.1 and the widgets now load.

Thanks

Alberto_Umana
Databricks Employee
Databricks Employee

Awesome, which DBR were you using before?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group