Skip to content

Receiving "error loading dependencies" message; actual problem is unclear #125

Closed

Description

@jwhendy

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:

2017-09-01_152848

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.

Activity

  1. chriddyp commented on Sep 4, 2017

    @chriddyp
    Member

    Yeah, this is a really bad error message. In fact, dependencies in this case doesn't even refer to the python dependencies, it refers to an underling /_dash-dependencies API endpoint... 🤕

  2. jasper-muller commented on Sep 22, 2017

    @jasper-muller

    Got the same issue here. Installed dash using

    pip install dash
    pip install dash-renderer
    pip install dash-html-components
    pip install dash-core-components
    pip install plotly --upgrade
    

    Next, I followed the scatterplot example in the getting started guide: https://plot.ly/dash/getting-started

    import dash
    import dash_core_components as dcc
    import dash_html_components as html
    import plotly.graph_objs as go
    import pandas as pd
    
    app = dash.Dash()
    
    df = pd.read_csv(
        'https://gist.githubusercontent.com/chriddyp/' +
        '5d1ea79569ed194d432e56108a04d188/raw/' +
        'a9f9e8076b837d541398e999dcbac2b2826a81f8/'+
        'gdp-life-exp-2007.csv')
    
    
    app.layout = html.Div([
        dcc.Graph(
            id='life-exp-vs-gdp',
            figure={
                'data': [
                    go.Scatter(
                        x=df[df['continent'] == i]['gdp per capita'],
                        y=df[df['continent'] == i]['life expectancy'],
                        text=df[df['continent'] == i]['country'],
                        mode='markers',
                        opacity=0.7,
                        marker={
                            'size': 15,
                            'line': {'width': 0.5, 'color': 'white'}
                        },
                        name=i
                    ) for i in df.continent.unique()
                ],
                'layout': go.Layout(
                    xaxis={'type': 'log', 'title': 'GDP Per Capita'},
                    yaxis={'title': 'Life Expectancy'},
                    margin={'l': 40, 'b': 40, 't': 10, 'r': 10},
                    legend={'x': 0, 'y': 1},
                    hovermode='closest'
                )
            }
        )
    ])
    
    if __name__ == '__main__':
        app.run_server()
    

    Which results in the following output in my terminal:

     * Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
    127.0.0.1 - - [22/Sep/2017 16:42:18] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [22/Sep/2017 16:42:18] "GET /_dash-layout HTTP/1.1" 200 -
    127.0.0.1 - - [22/Sep/2017 16:42:18] "GET /_dash-dependencies HTTP/1.1" 200 -
    

    And in my browser:
    screen shot 2017-09-22 at 16 56 52

    I'm running this from a virtual environment with the following packages installed:

    alabaster==0.7.10
    appnope==0.1.0
    astroid==1.5.3
    Babel==2.3.4
    bleach==1.5.0
    bumpversion==0.5.3
    certifi==2017.7.27.1
    chardet==3.0.4
    click==6.7
    cycler==0.10.0
    dash==0.18.3
    dash-core-components==0.12.6
    dash-html-components==0.7.0
    dash-renderer==0.10.0
    decorator==4.1.2
    docutils==0.13.1
    eneco==1.0.0
    entrypoints==0.2.3
    et-xmlfile==1.0.1
    Flask==0.12.2
    Flask-Compress==1.4.0
    Flask-SeaSurf==0.2.2
    hmmlearn==0.2.0
    html5lib==0.9999999
    idna==2.6
    imagesize==0.7.1
    ipykernel==4.6.1
    ipython==6.1.0
    ipython-genutils==0.2.0
    isort==4.2.9
    itsdangerous==0.24
    jdcal==1.3
    jedi==0.10.2
    Jinja2==2.9.6
    jsonschema==2.6.0
    jupyter-client==5.1.0
    jupyter-core==4.3.0
    lazy-object-proxy==1.3.0
    line-profiler==2.0
    MarkupSafe==1.0
    matplotlib==2.0.2
    mccabe==0.6.1
    mistune==0.7.4
    nb-conda==2.2.0
    nb-conda-kernels==2.1.0
    nbconvert==5.2.1
    nbformat==4.4.0
    notebook==5.0.0
    numpy==1.12.1
    numpydoc==0.7.0
    openpyxl==2.4.8
    pandas==0.20.1
    pandocfilters==1.4.1
    patsy==0.4.1
    pep8==1.7.0
    pexpect==4.2.1
    pickleshare==0.7.3
    plotly==2.0.15
    prompt-toolkit==1.0.14
    psutil==5.2.1
    ptyprocess==0.5.2
    pyflakes==1.5.0
    Pygments==2.2.0
    pylint==1.7.1
    pyparsing==2.2.0
    python-dateutil==2.6.1
    python-dotenv==0.6.4
    pytz==2017.2
    pyzmq==16.0.2
    QtAwesome==0.4.4
    qtconsole==4.3.0
    QtPy==1.2.1
    requests==2.18.4
    rope==0.10.5
    scikit-learn==0.18.2
    scipy==0.19.0
    seaborn==0.7.1
    simplegeneric==0.8.1
    six==1.11.0
    snowballstemmer==1.2.1
    Sphinx==1.6.3
    sphinxcontrib-websupport==1.0.1
    spyder==3.1.4
    statsmodels==0.8.0
    terminado==0.6
    testpath==0.3
    tornado==4.5.1
    tqdm==4.17.0
    traitlets==4.3.2
    typing==3.6.1
    urllib3==1.22
    wcwidth==0.1.7
    webencodings==0.5
    Werkzeug==0.12.2
    wrapt==1.10.8
    xlrd==1.0.0
    XlsxWriter==0.9.8
    
  3. jasper-muller commented on Sep 22, 2017

    @jasper-muller

    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.

  4. abieler commented on Oct 2, 2017

    @abieler

    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.

  5. jwhendy commented on Oct 2, 2017

    @jwhendy
    Author

    @abieler and @jasper-muller did you try my example above? I'm curious if it reproduces for either of you, or if it's possibly an ad blocker (which I also use) or sporadic/browser related.

    In my experience, it was reproducible by toggling the called out comment lines.

  6. jmineraud commented on Oct 3, 2017

    @jmineraud

    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 ?

  7. jmineraud commented on Oct 3, 2017

    @jmineraud

    I would like to add that npm run demo seems to work fine

  8. jasper-muller commented on Oct 4, 2017

    @jasper-muller

    @jwhendy tried your example and get the same error as you are getting: Error loading dependencies.

  9. abieler commented on Oct 4, 2017

    @abieler

    @jwhendy the issue is how you stack your input lists.
    Doing

        inputs = [in_a_lab, in_a]
        inputs.extend(in_b)
    

    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.

  10. jwhendy commented on Oct 4, 2017

    @jwhendy
    Author

    @abieler Agreed. Note this from my original post:

    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.

    and

    That said, if this is isn't really a "dependency error," might there be room improving the error message?

    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.

  11. abieler commented on Oct 5, 2017

    @abieler

    lol thats what I get for not reading through the whole post :)

  12. jwhendy commented on Oct 5, 2017

    @jwhendy
    Author

    @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!

  13. astratis commented on Jan 15, 2018

    @astratis

    Not an optimal solution but worked for me after installing again dash, hope it helps.

  14. tuckergordon commented on Jan 22, 2018

    @tuckergordon

    Wanted to follow-up that I think I'm having an issue similar to @jmineraud in that I'm trying to follow this tutorial to create a custom component and run it within a multi-page app. Unfortunately, I'm getting the "Error loading dependencies" message. I've made sure to include the component in app.layout to ensure that Dash sees it when looking for depencies and to avoid the known issue.

    Any ideas as to what could be going wrong?

  15. chriddyp commented on Jan 23, 2018

    @chriddyp
    Member

    Unfortunately, I'm getting the "Error loading dependencies" message. I've made sure to include the component in app.layout to ensure that Dash sees it when looking for depencies and to avoid the known issue.

    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?

  16. 31 remaining items

  17. Keou0007 commented on Oct 27, 2020

    @Keou0007

    @alexcjohnson @soerendip ok, that's starting to make sense. The complicating factor here is that I did actually setup a clean environment and the only thing I installed was dash, with conda create -n dash python=3.8 dash. The only condition specified here is python must be 3.8, so unless dash doesn't support 3.8 (?!) then there is a problem with the dependencies in the conda environment, at least for macOS if nothing else. Possibly this needs to be another issue? Should I open a new issue on here, or perhaps on the conda-forge repo?

    Back to the issue at hand, I found another issue suggesting you are looking for examples of how "error loading dependencies" can appear. Should I open a seperate issue and list how to cause it as I have here with the todo list example?

  18. jwhendy commented on Oct 27, 2020

    @jwhendy
    Author

    @Keou0007 I'm not familiar with conda, but you might have to dig into the intricacies of how it sources libraries. If I do pip install and something already exists, it will use the installed version unless I pass --upgrade, which will prompt a check to the repos to see if there's a newer version.

    Your pip freeze is outdated as well, including a pointer to a possibly custom build at some point? I wonder if conda just took what you already had.

    dash @ file:///tmp/build/80754af9/dash_1602169941850/work
    dash-core-components==1.3.1
    dash-html-components==1.0.1
    dash-renderer==1.1.2
    

    Again, no familiarity with conda, but it also stands out to me that some libs above have py_38 and all the dash related ones have py_0, which almost makes me think "default" or "already installed" vs. being specific to your python=38 flag.

  19. Keou0007 commented on Oct 27, 2020

    @Keou0007
    $ conda search dash*
    Loading channels: done
    # Name                       Version           Build  Channel             
    dash                           1.4.1            py_0  pkgs/main           
    dash                          1.14.0            py_0  pkgs/main           
    dash                          1.16.1            py_0  pkgs/main           
    dash                          1.16.2            py_0  pkgs/main           
    dash                          1.16.3            py_0  pkgs/main           
    dash-core-components           1.3.1            py_0  pkgs/main           
    dash-html-components           1.0.1            py_0  pkgs/main           
    dash-renderer                  1.1.2            py_0  pkgs/main           
    dash-renderer                  1.8.1            py_0  pkgs/main           
    dash-renderer                  1.8.2            py_0  pkgs/main           
    dash-table                     4.4.1            py_0  pkgs/main  
    

    Looks like the issue is old versions of core-components, html-components and table in the anaconda main repo. If I update using conda-forge I get all the newest versions. This means the problem will solve itself in time, but in the shorter term I see two possible solutions to the issue I hit (i.e. docs examples not working with not much indication of why):

    1. Push newer versions of the supporting packages to anaconda main repo. Is this even possible or out of your hands?
    2. Update the pattern matching docs page to specify required versions of the dependencies to avoid a situation where someone like me is seeing that they have the required version but it still isn't working and not knowing why.

    I could probably put together a PR for option 2 myself, but it would be more work for me than someone who already has a local fork setup for such things.

  20. Keou0007 commented on Oct 27, 2020

    @Keou0007

    @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.

  21. Keou0007 commented on Oct 27, 2020

    @Keou0007

    I got motivated: https://github.com/plotly/dash-docs/pull/1003

    Same issue with old packages in anaconda main repo exists on Linux also.

  22. alexcjohnson commented on Oct 28, 2020

    @alexcjohnson
    Collaborator

    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 with conda.

    Long-term, I think the solution will be to actually get rid of the dash-renderer package altogether, just merge it into the main dash 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, and dash-table into dash 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 of dash all the rest comes along for the ride.

  23. Keou0007 commented on Oct 29, 2020

    @Keou0007

    Not sure if you saw the conversation on the dash-feedstock page I posted, but I was wrong about conda-forge feeding into the anaconda main repo. Looks like the next thing would be to post an issue with anaconda and tell them they need to version lock the dash package in the main repo with its dependencies, matching the version locking that occurs for pip (which is replicated in the conda-forge feedstock). I think for now I've done my dash here though (haha), I can solve my issue by using the conda-forge version so I'll leave the rest to the experts.

  24. gvwilson commented on Jun 3, 2024

    @gvwilson
    Contributor

    Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions