Repository: voxel51/fiftyone

Issue:
[FR] Upgrade plotly
### Proposal Summary

Update plotly to the latest major version.

### Motivation

-   What is the use case for this feature? compatibility, reduced technical debt, multiple reasons I use the latest version
-   Why is this use case valuable to support for FiftyOne users in general? yes
-   Why is this use case valuable to support for your project(s) or
    organization? yes
-   Why is it currently difficult to achieve this use case? (please be as
    specific as possible about why related FiftyOne features and components are
    insufficient) Couldn't find any reason

### What areas of FiftyOne does this feature affect?

-   [ ] App: FiftyOne application
-   [x] Core: Core `fiftyone` Python library
-   [ ] Server: FiftyOne server

### Details

I checked the release logs and it seems like no feature was depricated. Since v5 plotly requires 3.6 minimum but so does fiftyone.

### Willingness to contribute

The FiftyOne Community encourages new feature contributions. Would you or
another member of your organization be willing to contribute an implementation
of this feature?

-   [x] Yes. I can contribute this feature independently.
-   [ ] Yes. I would be willing to contribute this feature with guidance from
        the FiftyOne community.
-   [ ] No. I cannot contribute this feature at this time.



Discussion:
Hi @twsl 👋 

When Plotly 5 was released, https://github.com/voxel51/fiftyone/issues/1099 was reported which led us to require `plotly>=4.14,<5` until we could figure out what breaking change Plotly 5 made that is preventing callbacks on our [interactive plots](https://voxel51.com/docs/fiftyone/user_guide/plots.html) from working as expected.

Sounds like you're familiar with Plotly 5; are you able to look into what tweak might be needed to get Plotly 5 to work so we can remove the `plotly<5` requirement?
I have just used it a few times, but I can try to find some time to look into it. Do you know, if this repo can participate in hacktoberfest?
I added the `hacktoberfest` topic to the repo, so I believe that means your PR will count towards hacktoberfest!
I haven't found any time so far and won't for at least another month, but plotly keeps increasing its version so i'd like to bring this back on the agenda
Hello! I have a project where I need fiftyone and a recent plotly-version (>5.0.0) and would greatly appreciate if this could be done!

Resolving patch:
diff --git a/fiftyone/core/plots/plotly.py b/fiftyone/core/plots/plotly.py
--- a/fiftyone/core/plots/plotly.py
+++ b/fiftyone/core/plots/plotly.py
@@ -1998,7 +1998,7 @@ class InteractiveScatter(PlotlyInteractivePlot):
     This wrapper responds to selection and deselection events (if available)
     triggered on the figure's traces via Plotly's lasso and box selector tools.
 
-    Traces whose ``customdata`` attribute contain numpy arrays are assumed to
+    Traces whose ``customdata`` attribute contain lists/arrays are assumed to
     contain the IDs of the points in the trace. Traces with no ``customdata``
     are allowed, but will not have any selection events.
 
@@ -2022,7 +2022,7 @@ def __init__(self, figure, **kwargs):
 
     def _init_traces(self):
         for idx, trace in enumerate(self._traces):
-            trace_ids = trace.customdata
+            trace_ids = np.asarray(trace.customdata)
             if trace_ids.ndim > 1:
                 trace_ids = trace_ids[:, 0]
 
@@ -2063,7 +2063,7 @@ def _make_widget(self):
         self._traces = [
             trace
             for trace in widget.data
-            if isinstance(trace.customdata, np.ndarray)
+            if etau.is_container(trace.customdata)
         ]
         self._init_traces()
         return widget
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -48,7 +48,7 @@ def get_version():
     "packaging",
     "pandas",
     "Pillow>=6.2",
-    "plotly>=4.14,<5",
+    "plotly>=4.14",
     "pprintpp",
     "psutil",
     "pymongo>=3.11,<4",


Test patch: