dash: Receiving "error loading dependencies" message; actual problem is unclear
Here is a minimal example after doing some trial and error to pin it down:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
def generate_inputs():
in_a_lab = html.Label('input a')
in_a = dcc.Input(type='number',
value=1)
in_b = [html.Label(html.Strong('input b')),
dcc.Input(type='number', value=1)]
inputs = [in_a_lab, in_a]
# uncomment this line to cause error
# inputs = [in_a_lab, in_a, in_b]
return inputs
app = dash.Dash()
app.layout = html.Div([
# switch the comment on these lines to cause an error
html.Div(generate_inputs())
# generate_inputs()
]) # app.layout
if __name__ == '__main__':
app.run_server(debug=True)
I started on the path of python3
, but ran into some dependency hell on Ubuntu 16.04, so I reinstalled with python2
. This created what I believe to be some actual dependency issues around urllib3
and chardet
. I was getting dependency warnings about the wrong versions on the command line when I would do python2 app.py
.
With those solved, the command line looked fine, but I’d get this in the browser:
I was in the process of building some ui elements and doing them in pairs, with a label and then matching input. Then I wanted to switch to a list of the label and pair together. I realized I was sending back a nested list (the above would generated something like [in_a_lab, in_a, [in_b_lab, in_b]]
). So, that was a definite issue, but I wouldn’t expect the result to be error loading dependencies
.
On accident I found that without wrapping the function return in html.Div()
I’m also getting the same error.
This is probably an issue on my part with something I don’t understand about dash
(totally likely; I’m all of 2-3 hours into playing with it). That said, if this is isn’t really a “dependency error,” might there be room improving the error message? From what I’m seeing, this strikes me as more of a syntax error, or something like “expected blah object, got blah instead”?
Thanks for taking a look.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 9
- Comments: 53 (9 by maintainers)
Commits related to this issue
- Develop (#133) * 3.1 props refactoring (#106) * refactor virtualization, virtualization settings, and derived props * refactor renaming paging / pagination props * refactor virtual, viewport and p... — committed to HammadTheOne/dash by Marc-Andre-Rivet 6 years ago
- 3.1 issue132 readonly tests (#134) * 3.1 props refactoring (#106) * refactor virtualization, virtualization settings, and derived props * refactor renaming paging / pagination props * refactor vir... — committed to HammadTheOne/dash by Marc-Andre-Rivet 6 years ago
- Develop (#133) * 3.1 props refactoring (#106) * refactor virtualization, virtualization settings, and derived props * refactor renaming paging / pagination props * refactor virtual, viewport and p... — committed to plotly/dash by Marc-Andre-Rivet 6 years ago
- 3.1 issue132 readonly tests (#134) * 3.1 props refactoring (#106) * refactor virtualization, virtualization settings, and derived props * refactor renaming paging / pagination props * refactor vir... — committed to plotly/dash by Marc-Andre-Rivet 6 years ago
I’m embarrassed to say that it turned out to be my ad blocker that was causing the problem.
Disabling ad block solved my issue.
Just for anyone else googling out there: Another possible cause for the error might be that you have a circular cycle in your set of callbacks i.e. callbacks that trigger themselves in a loop (embarrassing…). Check JS console for something like
Error: Dependency Cycle Found:...
.Are there any errors in the console? Do you have a github repo that we can use to try to replicate the issue? Are you serving the assets locally with
app.scripts.config.serve_locally=True
?@abieler Agreed. Note this from my original post:
and
This issue is about what I see as some sort of “blanket” error message that isn’t accurate or very helpful in debugging. So, yes, I passed a nested list. “Error loading dependencies” had very little chance in helping me find that out (being new).
I brought this issue forward so that the developers who know the internals of
dash
might be able to send back a message that more accurately describes what’s wrong.@jwhendy the issue is how you stack your input lists. Doing
works for me. In your solution
inputs
is a nested list, where with this one here it is a plain list. That said, the error message is not ideal.I have been running into the same issue while trying to follow the tutorial at . I am using virtualenv with Python 3 and I have install only the libraries required by Dash. I have tried to run from the same environment the example from and it works fine. So I believe, when I run
python usage.py
that the error loading dependencies message occurs when loading my example component (straight from the archetype, v0.2.11). Is there a way to do a quick fix that would enable me to load my custom component dependency ?Thanks for digging into this @Keou0007 - In the
pip
world all these packages are version-locked, so you have to work pretty hard to get incompatible versions. But it looks like the situation is more complicated withconda
.Long-term, I think the solution will be to actually get rid of the
dash-renderer
package altogether, just merge it into the maindash
package. That way there’s no way the two can get out of sync. It already lives in the same repo in GitHub… We originally kept them separate in order to ensure the architecture had a clear front-end / back-end break, looking ahead to different back-end languages, but in practice these other back ends just grab the final renderer JS bundle, and that doesn’t depend on this being a separate Python package.In fact we’ve even discussed folding
dash-core-components
,dash-html-components
, anddash-table
intodash
So that there wold be only one “core dash” package. We avoided that before for two reasons: (1) to ensure components were decoupled from the framework itself, in particular to make it easier to add more components, (2) so that if you aren’t using a given component package, your page doesn’t need to load its JS. But (1) has outlived its usefulness as there are tons of other component packages out there, and (2) is no longer a big deal since we have async loading, so initially you only load a small stub for each package.If we only had one package, there wouldn’t be anything to go wrong in
conda
- as soon as they include a new version ofdash
all the rest comes along for the ride.@jwhendy my understanding is that py_0 version means it’s python version independent. conda packages are built before distribution (unlike pip installs that are built on the local system after installation from source) and so some packages will be built for a specific python version and conda will contain a different build of those packages for each python version, hence py38 specific packages in some cases. In other cases, where it doesn’t matter so much, conda will only hold one version which can be used to install against any python version. Similarly, conda builds are OS specific, so this issue of old versions on the main repo may only occur on macOS. I will test on linux next time I’m logged in to my work machine.
@Keou0007 The latest
dash-renderer
version - which SHOULD be what you upgrade to when you getdash==1.16.3
- is1.8.2
. Pattern-matching callbacks - required for dictionary IDs - weren’t introduced until1.4.0
. I’m not sure how it happened, I don’t useconda
much, but you also have old versions ofdash-core-components
,dash-html-components
, anddash-table
.I had the same issue of ‘Error loading dependencies’. It was resolved by updating requirements doc with latest versions for all the modules. My list: certifi==2019.3.9 chardet==3.0.4 click==6.7 dash==0.40.0 dash-core-components==0.45.0 dash-html-components==0.15.0 dash-renderer==0.21.0 decorator==4.3.0 Flask==1.0.2 Flask-Compress==1.4.0 gunicorn==19.8.1 idna==2.7 ipython-genutils==0.2.0 itsdangerous==0.24 Jinja2==2.10 jsonschema==2.6.0 jupyter-core==4.4.0 MarkupSafe==1.0 nbformat==4.4.0 pandas==0.24.2 plotly==3.7.1 pytz==2018.5
six==1.11.0 traitlets==4.3.2
Werkzeug==0.14.1
Almost all of these issues will be resolved through our new component validation framework. There is a PR for this here: https://github.com/plotly/dash/pull/340. Please try out the prereleases in that branch and let us know how it goes! If you have feedback on that particular prerelease, please provide your feedback in the actual PR rather than here.
Many thanks ❤️
I have a problem with the Table example (https://dash.plot.ly/getting-started). It works just fine with provided CSV file, but if I change it to my own JSON file, I get the “error loading dependencies” error.
My app looks like this:
Basically this is breaking it:
It prints the headers correctly (if I comment out the body section), but data columns are not printed and results to the error message.
I have no idea how to debug this further, so any pointers would be appreciated 😃
@abieler It’s all good, and I actually forgot why I wanted you to replicate… I was noting that @jasper-muller found the issue related to adblock, and you said it was sporadic. I just wanted to make sure this wasn’t on my end, as I wasn’t experiencing it as sporadic. Thanks!
@jwhendy tried your example and get the same error as you are getting:
Error loading dependencies
.I do get the same error every once in a while. It is not reproducible in my case as it suddenly starts/stops working without changing the code or anything. I first thought it is a browser problem as it initially happened only on Firefox and Chrome was fine. Happens on Chrome now too.