Black Lives Matter. Please consider donating to Black Girls Code today.

The dependency 'dash_core_components-shared.js' could not be loaded

Hi there, I have a sudden and unexpected problem. I am using DashR for a while now without any problems but today all of a sudden figures are not displayed. However DataTables and other components work fine. These are the error messages:

In Browser:

R Console:

I already tried updating the library:

install.packages('dash')

Without success.

Can someone please help me?
Thank you

Hi @HansPeter123 – thanks very much for reporting this issue and sharing the error/stack trace. I attempted to reproduce this error locally, but I was unable to do so.

It looks like you might have installed packages from GitHub previously, since v1.10.0 is the most recent release available from CRAN (vs. v1.10.2). Mixing the CRAN and GitHub versions of dash and the component libraries (which are currently out of sync) could compound the issue you were experiencing before.

I see two versions for the dashCoreComponents package (v1.10.2 and v1.6.0) in the stack trace, which is somewhat unexpected. I’d like to try a clean install, and see if that helps.

Try quitting R (or RStudio), restarting, then the following prior to loading any packages:

if ("dash" %in% rownames(installed.packages()))
  remove.packages("dash")
if ("dashHtmlComponents" %in% rownames(installed.packages()))
  remove.packages("dashHtmlComponents")
if ("dashCoreComponents" %in% rownames(installed.packages()))
  remove.packages("dashCoreComponents")
if ("dashTable" %in% rownames(installed.packages()))
  remove.packages("dashTable")

Once done, quit and restart R, then

install.packages("dash")

Please let me know if this resolves the issue; I’m happy to help investigate further if a clean install doesn’t do the trick.

Hi @rpkyle, I completely uninstalled R and RStudio, then downloaded the newest versions and afterwords downloaded all the packages. Dash is now able to render plots. To test this I used example code from the documentation:

library(dash)
library(dashCoreComponents)
library(dashHtmlComponents)

app <- Dash$new()

app$layout(
  htmlDiv(
    list(
      htmlH1('Hello Dash'),
      htmlDiv(children = "Dash: A web application framework for R."),
      dccGraph(
        figure=list(
          data=list(
            list(
              x=list(1, 2, 3),
              y=list(4, 1, 2),
              type='bar',
              name='SF'
            ),
            list(
              x=list(1, 2, 3),
              y=list(2, 4, 5),
              type='bar',
              name='Montr\U{00E9}al'
            )
          ),
          layout = list(title='Dash Data Visualization')
        )
      )
    )
  )
)

app$run_server()

The strange thing is that I am now getting errors with my own layouts. The error is ‘unused arguments’. It seems I have to place all my components inside the following structure:

app$layout(
  htmlDiv(
    list(
      dccGraph(id = 'plot1', figure = plot1),
      dccGraph(id = 'plot2', figure = plot2)
    )
  )
)

Previously Dash wasn’t that restrictive. Are you aware of any changes inside Dash?

Old code that worked:

app$layout(
  dccGraph(id = 'plot_all', figure = plot_all),
  dccGraph(id = 'plot_progress', figure = plot_progress)
)

Thank you very much :slight_smile:

@HansPeter123 Ah, yes – I apologize for any headaches this has caused. I believe this change occurred in v0.5.0, just prior to the release on CRAN, in PR #121.

Before this PR was merged, we explicitly wrapped value internally within htmlDiv and it was possible to pass something like

app$layout(
   htmlDiv("a", id="a"),
   htmlDiv("b", id="b")
)

Unfortunately, while convenient for R users, this was also idiosyncratic since the equivalent of layout within Dash for Python requires that its argument provides a component or a collection of components, specified either as a component itself or a function which returns one.

The previous behaviour had the unintended side effect of requiring any third party package to load dashHtmlComponents first (e.g. facultyai/dash-bootstrap-components#370), which is no longer required.

Hopefully this answers your question. The good news here is that our efforts to keep Dash for R up to date with the Python implementation have continued, and the next release of dash will incorporate just about all that remains for true parity with Python: pattern-matching callbacks, setting and validating attributes for scripts and stylesheets, user-defined server routes, and callback graph timing/visualization improvements. :slightly_smiling_face:

1 Like

Hi @rpkyle, sorry for the late comment. You really don’t have to apologize. Dash is amazing, and I am starting to use Dash for Python more than DashR now. The only thing that bugged me was what caused this problem (i.e. which accidental change was made by me). Anyways you can consider this topic as closed.
Thank you for your help!