plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Error Received value: 'rgba(255, 153, 51, np.float64(1.0))' when using cufflinks to make figures after upgrading python to 3.13.2 and plotly to 6.0.0

Open Rob-Hulley opened this issue 10 months ago • 7 comments

I needed to rebuild my windows workstation (win 10) and decided to install the latest python and plotly software. Now all my charts using cufflinks fail with the error:

ValueError: Invalid value of type 'builtins.str' received for the 'color' property of bar.marker.line Received value: 'rgba(255, 153, 51, np.float64(1.0))'

Edition Windows 10 Pro Version 22H2 Installed on ‎17/‎02/‎2025 OS build 19045.5487 Experience Windows Feature Experience Pack 1000.19061.1000.0

Python 3.13.2 pandas 2.2.3 plotly 6.0.0 cufflinks 0.17.3

The below code will recreate the issue in Jupiter labs

from plotly.subplots import make_subplots import plotly.graph_objects as go import plotly.io as pio import pandas as pd import cufflinks as cf

index=['2024-09-05 05:56:33.238','2024-09-05 05:56:34.238','2024-09-05 05:56:35.241','2024-09-05 05:56:36.239','2024-09-05 05:56:37.239', '2024-09-05 05:56:38.241','2024-09-05 05:56:39.239','2024-09-05 05:56:40.239','2024-09-05 05:56:41.240','2024-09-05 05:56:42.240']

cols=pd.MultiIndex.from_tuples([ ('rcount','0:3:1'),('rcount','0:3:2'),('rcount','1:3:1'),('rcount','1:3:2'), ('wcount','0:3:1'),('wcount','0:3:2'),('wcount','1:3:1'),('wcount','1:3:2'), ('tcount','0:3:1'),('tcount','0:3:2'),('tcount','1:3:1'),('tcount','1:3:2'),])

data=[[22.0,21.0,32.0,31.0,24.0,20.0,40.0,40.0,47.0,42.0,72.0,72.0], [0.0,0.0,0.0,0.0,4.0,2.0,4.0,1.0,4.0,2.0,4.0,1.0], [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], [0.0,0.0,0.0,1.0,0.0,0.0,2.0,4.0,0.0,0.0,2.0,5.0], [0.0,0.0,0.0,0.0,3.0,1.0,16.0,11.0,3.0,1.0,16.0,11.0], [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], [0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0], [0.0,0.0,1.0,0.0,4.0,2.0,9.0,0.0,4.0,2.0,11.0,0.0], [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], [0.0,0.0,0.0,0.0,2.0,1.0,2.0,1.0,2.0,1.0,2.0,1.0]]

df=pd.DataFrame(data, columns=cols,index=index)

fig = cf.subplots([df.loc[:,('rcount')].figure(kind='scatter'), df.loc[:,('wcount')].figure(kind='scatter'), df.loc[:,('tcount')].figure(kind='scatter'),], shape=(3,1),shared_xaxes=True,shared_yaxes=False,subplot_titles=('READ','WRITE','TOTAL'))

Rob-Hulley avatar Feb 20 '25 02:02 Rob-Hulley

Thanks for the report @Rob-Hulley - I'll see if we can have someone take a look in the next cycle. Is there any easy way to see if it works without cufflinks, or would that essentially mean rewriting the whole app / example?

gvwilson avatar Feb 20 '25 18:02 gvwilson

My program creates 1000's of charts about 100 use cufflinks. All other charts are OK, it is just cufflinks which has the error about the color selection. I think it is the np.float64(1.0) causing the issue. cufflinks does not seem to like the later version of numpy.

I can re-write those charts to not use cufflinks, but cufflinks makes things much easier. For now I will revert back to the older versions that work so I can continue to update code.

Rob-Hulley avatar Feb 20 '25 22:02 Rob-Hulley

This is what the values look like in the working older code

rgba(255, 153, 51, 1.0)

Rob-Hulley avatar Feb 20 '25 22:02 Rob-Hulley

NixOS patch fixes this for me

dcurrie avatar Apr 27 '25 12:04 dcurrie

My program creates 1000's of charts about 100 use cufflinks. All other charts are OK, it is just cufflinks which has the error about the color selection. I think it is the np.float64(1.0) causing the issue. cufflinks does not seem to like the later version of numpy.

I can re-write those charts to not use cufflinks, but cufflinks makes things much easier. For now I will revert back to the older versions that work so I can continue to update code.

Hi, I've experienced the same issue as you, could you please tell me which older versions of plotly, cufflinks or numpy fix this bug?@Rob-Hulley

BaoNguyen0207207 avatar Oct 11 '25 06:10 BaoNguyen0207207

These are the current versions I am using:

Python 3.11.5 cufflinks 0.17.3 pandas 2.1.0 plotly 5.24.1

Rob-Hulley avatar Oct 12 '25 20:10 Rob-Hulley

These are the current versions I am using:

Python 3.11.5 cufflinks 0.17.3 pandas 2.1.0 plotly 5.24.1

Thanks a lot!

BaoNguyen0207207 avatar Oct 13 '25 01:10 BaoNguyen0207207