-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError(“Invalid value”) in basedatatypes.py #3441
Comments
Here is a reproducible (almost reliably) example. Start the script, wait a few sec, access the page at localhost:5000. The failures happen at random on either of the four graphs or several of them at once. Plotly 5.4.0 Running the code with Note that this only occurs on the initial startup of the app and the first visit to the page. When the webpage is refreshed, the error does not re-appear, and all plots get displayed without errors. The error message and the screenshot are given below.
The error:
|
I am also hit by this. Is there any progress? |
I have not heard anything yet, besides a workaround by LeoWY here https://community.plotly.com/t/valueerror-invalid-value-in-basedatatypes-py/55993/6 |
I found the same problem. Any progress apart from the workaround with the |
Also facing the same issue with a similar setup (Plotly 5.6.0 and Dash 2.3.0) and use case. Exact same behaviour observed : dash app plotting several graphs and a random number of them are not being displayed at startup, with the same error thrown as stated above. |
Same issues here with Plotly 5.6.0 and Dash 2.1.0. For some reason the workaround with the try clause avoids errors. |
Fixed by adding: e.g.
|
Thanks, @KnopKirrie. That helped. I have 11 graphs in 4 tabs in a Dash app, which consistently produced the So, to implement your approach, I removed the Note that previously, I did not have the value for the As an experiment, I also tried using |
FYI - This same error is still occurring when using plotly/dash, in 2024. Luckily, the above fix by "KnopKirrie" still works. In fact, you only have to include this line one time before any of your other plotly or dash code: go.Figure(layout=dict(template='plotly')) |
@plan-9-from-outer-space , Can you please share the code the reproduces this error? |
Original poster is here. The code sample I submitted in 2021 produces the error just fine. I have just tested it again in Dash 2.15.0 and got the same error. As many other reporters clearly indicated, the nature of this error seems random. Try running the code a few times, and opening a fresh browser tab perphaps for each try? |
Below is a link to a self-contained file of code that shows the error. I am using plotly 5.18.0 and dash 2.15.0 (both are the latest versions on pypi.org). I am using python 3.11.7. BTW, I also get an annoying warning from plotly, which gets printed to the terminal whenever I click on one of the dash tabs: C:...\envs\PY1\Lib\site-packages\plotly\express_core.py:2065: FutureWarning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass (name,) instead of name to silence this warning. Below is the link to a file that shows the error. Just save locally and run "python dashboard.py". I forgot to mention -- you will need to comment out line 26, which is the bug fix. |
The @sergiykhan and @plan-9-from-outer-space thanks for the self-contained apps. But I'm afraid I'm still unable to reproduce this error using either, no matter how much I restart or reload. Looks like it's happening both on Windows and on Linux, any other info those seeing this can give to help us reproduce? |
I created a new python environment, installed only python 3.11.7, dash, and pandas, and the same error occurs. I am running Windows 11. Can you try doing that? |
That's exactly what I did before, but upon doing it again I did see the error! Seems like there's some sort of a race condition when you fire multiple figure callbacks simultaneously, I couldn't get it to happen with only one graph callback. But also after one or two times showing the error it never happens again, no matter how many times I stop Python and restart it, and/or close and reopen the page, so it's like plotly.py has sorted itself out, maybe generated Thanks for your patience - this is still going to be tricky to figure out but at least I've seen it now! |
@alexcjohnson Not sure if it helps, but here is a bit more info about my test (original post). I keep the Chrome tab open at http://localhost:5000/, and hit F5 to refresh the page after the app is re-launched. The algorithm: launch the app, hit F5, check if there is an error, close the app. Repeat. Right now, I did about 15 attempts. Three attempts produced an error. The number of unrendered plots was between 1 and 3. I do not recreate the Python virtual environment nor do I clean any files. |
After upgrading to Plotly 5 (either 5.1.0 or 5.2.2, or 5.3.1, 5.4.0), I am seeing the error (given below) for various plots, at random. The issue goes away if Plotly is downgraded to 4.14.3.
Here are relevant reports from me and other users
I have a Dash app that plots several graphs. When the Dash app starts, some plots do not get displayed, and I see the error. This only occurs on the initial startup of the app. When the webpage is refreshed, the error does not re-appear, and all plots get displayed without errors.
If I downgrade to Plotly 4.14.3, the issue goes away entirely.
The text was updated successfully, but these errors were encountered: