Skip to content
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

RStudio Viewer does not function properly on the new R version R-4.4.0 on Windows 11. #14603

Closed
5 of 6 tasks
bergarog opened this issue Apr 28, 2024 · 21 comments
Closed
5 of 6 tasks

Comments

@bergarog
Copy link

bergarog commented Apr 28, 2024

Note from @kevinushey: if you're encountering issues with plots and HTML widgets not displaying in the RStudio Viewer pane with R 4.4.0 on Windows, the issue should be resolved with the latest patch releases of R available at https://cran.r-project.org/bin/windows/base/rpatched.html. Thanks!

Verify fixed in:

  • Patch: 2024.04.1
  • Release: 2024.07.0

System details

RStudio Edition : Desktop
RStudio Version : 2024.04.0+737 Chocolate Cosmos (desktop)
OS Version      : Windows 11 x64 (build 22621)
R Version       : R version 4.4.0 (2024-04-24 ucrt)

Steps to reproduce the problem

Windows 11
Install R-4.4.0
Install latest Version of RStudio

install.packages("plotly")
plotly::plot_ly(x = rnorm(100), y = rnorm(100), mode = "markers", type = "scatter")

Describe the problem in detail

RStudio Viewer does not function properly on the new R version R-4.4.0 on Windows 11. The Viewer remains blank.

I encountered this issue using RStudio Version 2023.12.1-402, and after updating to the latest build, 2024.04.0+737, the problem persisted.

Screenshot 2024-04-28 201753

However, when I ran the same code in the standard R Console, the expected Scatterplot appeared in my default browser.

Describe the behavior you expected

When reverting to R-4.3.3, everything functions as normal.

Screenshot 2024-04-28 201549

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@bergarog bergarog added bug new New incoming issues, ready for initial review. labels Apr 28, 2024
@ronblum
Copy link
Contributor

ronblum commented Apr 29, 2024

@bergarog Thank you for raising the issue! I can reproduce this in RStudio Desktop Pro 2024.04.0+735.pro3 on Windows 11. We'll review the issue.

Note: Other plotting works, e.g.
plot(cars)
and this example from R for Data Science:
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy), position = "jitter")

@ronblum ronblum added plots and removed new New incoming issues, ready for initial review. labels Apr 29, 2024
@ronblum ronblum added this to the Cranberry Hibiscus milestone Apr 29, 2024
@jthomasmock
Copy link
Contributor

Can we try this out with a few other htmlwidgets? Would be great to confirm if this is a problem in plotly or RStudio itself with R 4.4

@kevinushey
Copy link
Contributor

Looks like something is going wrong when attempting to load the requisite JS libraries.

Screenshot 2024-04-29 at 9 54 37 AM

@jthomasmock
Copy link
Contributor

Seems to be working OK on Mac Version 2024.04.0-daily+696 (2024.04.0-daily+696) with R v4.4 so maybe a Windows-only bug.

@stevenpandrews
Copy link

FWIW, I'm having the same trouble with plotly, mapview/leaflet, ggiraph, and DT on RStudio/2023.12.1+402, R-4.4.0 on Windows 10. I was able to "Save as webpage" and the plot/map/interactive plot/DT saved successfully.

@kevinushey
Copy link
Contributor

I can also confirm that the issue seems to occur only on Windows with R 4.4.0; it seems to affect all kinds of htmlwidget output. I suspect we'll need to fix this in a patch release of RStudio.

@bergarog
Copy link
Author

Many thanks for investigating this issue. As a temporary solution, I've a minimal print method that utilizes Chrome as viewer. Perhaps this might also help someone else.

print.htmlwidget <- function(widget){
  temp_file <- paste(tempfile('widget'), 'html', sep = '.')
  htmlwidgets::saveWidget(widget, temp_file, selfcontained = FALSE)
  shell(sprintf("start chrome -app=file://%s", temp_file))
}
plotly::plot_ly(x = rnorm(100), y = rnorm(100), mode = "markers", type = "scatter")

Thanks to https://stackoverflow.com/questions/44048347/r-open-plotly-in-standalone-window, with no guarantee that this will work for others.

@ronblum ronblum modified the milestones: Cranberry Hibiscus, patch, Patch 2024.04.1 May 1, 2024
@kevinushey kevinushey self-assigned this May 1, 2024
@kevinushey
Copy link
Contributor

A simpler reprex:

file <- tempfile(fileext = ".html")
writeLines("<html>Hello</html>", con = file)
.rs.api.viewer(file)

This seems to fail ~50% of the time. That is, the problem seems specific to attempts to view static viewer content in the Viewer pane. As far as I can see, other web content (like Shiny applications) appear to still be fine, even when displayed in the Viewer pane.

Perhaps this is related to some of the work done to speed up the handling of static web resources that was done?

@kevinushey
Copy link
Contributor

kevinushey commented May 1, 2024

These requests actually get routed through R's help server, so it's the one responsible for retrieving the requested file in these contexts. The simplest fix here is probably to ... not do that.

@helgasoft
Copy link

helgasoft commented May 2, 2024

Can confirm this issue for Windows 10, R v.4.4.0, RStudio 2024.04.0+735 "Chocolate Cosmos".
All js and css files are not loaded in Viewer due to ERR_SOCKET_NOT_CONNECTED.

@bergarog's print.htmlwidget is a great workaround though!
Also there is an old similar #6737 that turned out to be an R issue...

@ronblum
Copy link
Contributor

ronblum commented May 2, 2024

QA note: Also to reproduce, create a new D3 file (which is JavaScript) with the default content and click "Preview".

@kevinushey
Copy link
Contributor

To confirm, this issue will likely affect all static HTML content that we try to show in the Viewer, which includes all sorts of htmlwidgets outputs.

@kevinushey
Copy link
Contributor

This issue should now be resolved in the latest patched builds of R 4.4.0 for Windows. Those are available here:

https://cran.r-project.org/bin/windows/base/rpatched.html

If you're encountering this issue, can you please try installing and using this patched build of R, and let us know if the problem persists?

@helgasoft
Copy link

@kevinushey - thanks. Confirmed working with R version 4.4.0 Patched (2024-05-03 r86521 ucrt) -- "Puppy Cup"
So it was R's fault after all...🧐

@asadow
Copy link

asadow commented May 6, 2024

@kevinushey Works

@kevinushey kevinushey pinned this issue May 6, 2024
@mbedward
Copy link

mbedward commented May 7, 2024

@kevinushey - working well now, many thanks.

@bergarog
Copy link
Author

bergarog commented May 7, 2024

@kevinushey - R Version 4.4.0 Patched (2024-05-03 r86521 ucrt) -- 'Puppy Cup' works in RStudio 2024.04.0 Build 735 and RStudio 2024.07.0 Build 75. Thank you very much!

@bergarog bergarog closed this as completed May 7, 2024
@ronblum
Copy link
Contributor

ronblum commented May 7, 2024

Verified that earlier versions of RStudio Desktop also now work on Windows 11, including 2023.03.2+454 and 2023.12.1+402 (in addition to 202404.0+735 an 2024.07.0+102).

plotly::plot_ly(x = rnorm(100), y = rnorm(100), mode = "markers", type = "scatter")
mapview::mapview(mapview::breweries)
leaflet::leaflet() |> leaflet::addTiles()

@MariaSemple
Copy link
Collaborator

Just changing the close type

@CorradoLanera
Copy link

FYI, on Win 11 edu and RStudio Desktop Pro 2024.04.0 Build 735.pro3, the same issue/solution happened with {targets}'s tar_visnetwork. I.e., when on R 4.4.0, it shows nothing but an empty white page (from which you can effectively Export/save as Web Page..., open the saved file on a browser, and see the result!!); and the issue is solved using R 4.4.0Patched, as you suggested.

You can use as a reprex tar_visnetwork's example code:

tar_dir({ # tar_dir() runs code from a temp dir for CRAN.
tar_script({
  tar_option_set()
  list(
    tar_target(y1, 1 + 1),
    tar_target(y2, 1 + 1),
    tar_target(z, y1 + y2, description = "sum of two other sums")
  )
})
tar_visnetwork()
tar_visnetwork(allow = starts_with("y")) # see also any_of()
})

@estadisticaun
Copy link

Had the same problem on Windows 10 and with R Version 4.4.0 Patched (2024-05-03 r86521 ucrt) -- 'Puppy Cup' works in RStudio 2024.04.1 Build 748 was fixed, please the moment.

https://cran.r-project.org/bin/windows/base/rpatched.html

Thanks to those who provided this output

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

No branches or pull requests