简体   繁体   English

R plotly::save_image / kaleido: static 从 R 导出不工作

[英]R plotly::save_image / kaleido : static export from R not working

I am trying to save a static image from a plotly graph using plotly::save_image(), but everytime I run this function, Rstudio gets stack (busy red icon) and needs to be restarted.我正在尝试使用 plotly::save_image() 从 plotly 图形中保存 static 图像,但每次我运行此 function 时,Rstudio 都会获取堆栈(忙碌的红色图标)并需要重新启动。 There is not any error message displayed.没有显示任何错误消息。

I have run the following commands and they all seem to have been installed correctly:我运行了以下命令,它们似乎都已正确安装:

install.packages('reticulate')安装.packages('网状')
reticulate::install_miniconda()网状::install_miniconda()
reticulate::conda_install('r-reticulate', 'python-kaleido')网状::conda_install('r-reticulate', 'python-kaleido')
reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly')网状::conda_install('r-reticulate', 'plotly', channel = 'plotly')
reticulate::use_miniconda('r-reticulate')网纹::use_miniconda('r-reticulate')

RStudio gets stack in a busy (red circle) state when save_image(p, tmp) is run:运行 save_image(p, tmp) 时,RStudio 在忙碌(红色圆圈)中获取堆栈 state:

p <- plot_ly(x = 1:10) p <- plot_ly(x = 1:10)
save_image(p, "test.png") save_image(p, "test.png")


Thank you for your help谢谢您的帮助


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Additional information including sessionInfo() output: 附加信息包括 sessionInfo() output:


System type: 64-bit operating system, x64-based processor系统类型:64位操作系统,基于x64的处理器

Edition: Windows 10 Enterprise版号:Windows 10企业
version: 21H2版本:21H2
Installed on: 29/04/2022安装于:29/04/2022

plotly version: 4.10.0 plotly 版本:4.10.0
reticulate version: 1.24网状版本:1.24


R version 4.2.0 (2022-04-22 ucrt) R 版本 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)平台:x86_64-w64-mingw32/x64(64 位)
Running under: Windows 10 x64 (build 19044)运行于:Windows 10 x64(内部版本 19044)

Matrix products: default矩阵产品:默认

locale:语言环境:
LC_COLLATE=English_New Zealand.utf8 LC_COLLATE=English_New Zealand.utf8
LC_CTYPE=English_New Zealand.utf8 LC_CTYPE=English_New Zealand.utf8

LC_M.NETARY=English_New Zealand.utf8 LC_M.NETARY=English_New Zealand.utf8
LC_NUMERIC=C LC_NUMERIC=C

LC_TIME=English_New Zealand.utf8 LC_TIME=English_New Zealand.utf8


attached base packages:附加基础包:
stats统计数据
graphics图形
grDevices grDevices
utils效用
datasets数据集
methods方法
base根据


other attached packages:其他附包:
plotly_4.10.0 plotly_4.10.0
ggplot2_3.3.5 ggplot2_3.3.5

loaded via a namespace (and not attached):通过命名空间加载(而不是附加):
pillar_1.7.0 pillar_1.7.0
compiler_4.2.0 compiler_4.2.0
tools_4.2.0 tools_4.2.0
digest_0.6.29摘要_0.6.29
viridisLite_0.4.0 viridisLite_0.4.0
jsonlite_1.8.0 jsonlite_1.8.0
evaluate_0.15评估_0.15
lifecycle_1.0.1生命周期_1.0.1
tibble_3.1.6 tibble_3.1.6
gtable_0.3.0 gtable_0.3.0
pkgconfig_2.0.3 pkgconfig_2.0.3
rlang_1.0.2 rlang_1.0.2
cli_3.3.0 cli_3.3.0
DBI_1.1.2 DBI_1.1.2
yaml_2.3.5 yaml_2.3.5
xfun_0.30 xfun_0.30
fastmap_1.1.0 fastmap_1.1.0
httr_1.4.2 httr_1.4.2
withr_2.5.0 withr_2.5.0
dplyr_1.0.8 dplyr_1.0.8
knitr_1.39 knitr_1.39
generics_0.1.2泛型_0.1.2
vctrs_0.4.1 vctrs_0.4.1
htmlwidgets_1.5.4 htmlwidgets_1.5.4
grid_4.2.0 grid_4.2.0
tidyselect_1.1.2 tidyselect_1.1.2
glue_1.6.2胶水_1.6.2
data.table_1.14.2 R6_2.5.1 data.table_1.14.2 R6_2.5.1
fansi_1.0.3 fansi_1.0.3
rmarkdown_2.14 rmarkdown_2.14
bookdown_0.26 bookdown_0.26
tidyr_1.2.0 tidyr_1.2.0
purrr_0.3.4 purrr_0.3.4
magrittr_2.0.3 magrittr_2.0.3
scales_1.2.0秤_1.2.0
ellipsis_0.3.2省略号_0.3.2
htmltools_0.5.2 htmltools_0.5.2
assertthat_0.2.1断言_0.2.1
colorspace_2.0-3 colorspace_2.0-3
utf8_1.2.2 utf8_1.2.2
lazyeval_0.2.2 lazyeval_0.2.2
munsell_0.5.0孟塞尔_0.5.0
crayon_1.5.1蜡笔_1.5.1

I hope this still helps, I think I found the solution.我希望这仍然有帮助,我想我找到了解决方案。 Apparently in windows 10 and 11, you need an older version of kaleido.显然在 windows 10 和 11 中,您需要旧版本的万花筒。 To get it, instead of: reticulate::conda_install('r-reticulate', 'python-kaleido') try reticulate::conda_install('r-reticulate', 'python-kaleido==0.1.*')要获得它,而不是: reticulate::conda_install('r-reticulate', 'python-kaleido')尝试reticulate::conda_install('r-reticulate', 'python-kaleido==0.1.*')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM