Problem with ipywidgets and plotly on Databricks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2025 01:41 AM - edited 04-09-2025 01:44 AM
Hi everyone,
I am encountering a problem when using ipywidgets with plotly on Databricks. I am trying to pass interactive arguments to a function and then plot with plotly.
When I do the following
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2025 12:56 PM
It would help a lot if you attach a notebook or copy the full code that demonstrates the problem. This would make it easy for someone to copy/paste, run, and troubleshoot it and you are more likely to get effective help that way 😉
Also, since your Databricks notebook runs on some kind of Databricks compute, it might be useful to mention what are the parameters of that compute. If it is not serverless, you could include a screenshot of the cluster configuration. Things that could matter in troubleshooting are the access mode and whether it's a single user cluster and what version of Databricks does it run.
I hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 05:48 AM
Thanks for the suggestion! You're absolutely right. The code was already all in my message, but I can make it easier to copy-paste (and add the imports):
from ipywidgets import interactive
import matplotlib.pyplot as plt
import numpy as np
def f(m, b):
plt.figure(2)
x = np.linspace(-10, 10, num=1000)
plt.plot(x, m * x + b)
plt.ylim(-5, 5)
plt.show()
interactive_plot = interactive(f, m=(-2.0, 2.0), b=(-3, 3, 0.5))
output = interactive_plot.children[-1]
output.layout.height = '350px'
interactive_plot
I'll also include details about the Databricks compute environment in a screenshot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2025 11:38 AM
I'm having this same exact issue. @moseb any chance you were able to figure it out?