Я пытаюсь установить keras в rstudio версии 1.2.5033. Я планировал использовать Python 3.7 в среде Анаконды. Однако у меня возникают проблемы при попытке запустить следующий код
library(keras)
model <- keras_model_sequential()
Я получил следующую ошибку
Error: lexical error: invalid char in json text.
NA
(right here) ------^
Я пытался проверить настройки python с помощью следующего кода
library(reticulate)
py_config()
, но также получил то же сообщение об ошибке
Error: lexical error: invalid char in json text.
NA
(right here) ------^
Я попытался установить python в среде анаконды, используя следующий код
reticulate::use_python("C:/Users/user/anaconda3/envs/r-tensorflow", required=TRUE)
и когда я запускаю
library(keras)
model <- keras_model_sequential()
, я получаю следующее сообщение
running command '"C:/Users/user/anaconda3/envs/r-tensorflow/python.exe" "C:/Users/user/Documents/R/win-library/3.6/reticulate/config/config.py"' had status 1running command '"C:/Users/user/anaconda3/envs/r-tensorflow/python.exe" "C:/Users/user/Documents/R/win-library/3.6/reticulate/config/config.py"' had status 1running command '"C:/Users/user/anaconda3/envs/r-tensorflow/python.exe" "C:/Users/user/Documents/R/win-library/3.6/reticulate/config/config.py"' had status 1Error in python_config(python_version, required_module, python_version, :
Error 1 occurred running C:/Users/user/anaconda3/envs/r-tensorflow/python.exe
Я пытался использовать
install_github("rstudio/reticulate")
install_github("rstudio/tensorflow")
install_github("rstudio/keras")
, но это все равно приводило к ошибкам.
Я искал все источники, но не нашел никого с такой же проблемой, как у меня. Может кто-то помочь мне с этим. Информация о моей сессии ниже.
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reticulate_1.14
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 rstudioapi_0.11 knitr_1.28 magrittr_1.5 usethis_1.5.1 devtools_2.2.2 pkgload_1.0.2
[8] R6_2.4.1 rlang_0.4.5 fansi_0.4.1 tools_3.6.3 pkgbuild_1.0.6 xfun_0.12 sessioninfo_1.1.1
[15] cli_2.0.2 withr_2.1.2 ellipsis_0.3.0 remotes_2.1.1 assertthat_0.2.1 digest_0.6.25 rprojroot_1.3-2
[22] crayon_1.3.4 processx_3.4.2 callr_3.4.2 fs_1.3.2 ps_1.3.2 curl_4.3 testthat_2.3.2
[29] memoise_1.1.0 glue_1.3.1 compiler_3.6.3 desc_1.2.0 backports_1.1.5 prettyunits_1.1.1 jsonlite_1.6.1
devtool::session info
- Session info -------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.6.3 (2020-02-29)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United Kingdom.1252
ctype English_United Kingdom.1252
tz Asia/Bangkok
date 2020-03-17
- Packages -----------------------------------------------------------------------------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.2)
backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.6.0)
callr 3.4.2 2020-02-12 [1] CRAN (R 3.6.3)
cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.2)
curl 4.3 2019-12-02 [1] CRAN (R 3.6.2)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.2)
devtools 2.2.2 2020-02-17 [1] CRAN (R 3.6.3)
digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.2)
fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.2)
fs 1.3.2 2020-03-05 [1] CRAN (R 3.6.3)
generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.2)
glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.3)
jsonlite 1.6.1 2020-02-02 [1] CRAN (R 3.6.3)
keras * 2.2.5.0 2019-10-08 [1] CRAN (R 3.6.3)
knitr 1.28 2020-02-06 [1] CRAN (R 3.6.3)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.2)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.2)
pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.2)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.2)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.3)
processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.3)
ps 1.3.2 2020-02-13 [1] CRAN (R 3.6.3)
R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.2)
Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.2)
remotes 2.1.1 2020-02-15 [1] CRAN (R 3.6.3)
reticulate * 1.14 2019-12-17 [1] CRAN (R 3.6.3)
rlang 0.4.5 2020-03-01 [1] CRAN (R 3.6.3)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.2)
rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.6.3)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.2)
tensorflow 2.0.0 2019-10-02 [1] CRAN (R 3.6.3)
testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
tfruns 1.4 2018-08-25 [1] CRAN (R 3.6.3)
usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.2)
whisker 0.4 2019-08-28 [1] CRAN (R 3.6.2)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.2)
xfun 0.12 2020-01-13 [1] CRAN (R 3.6.2)
zeallot 0.1.0 2018-01-28 [1] CRAN (R 3.6.2)
[1] C:/Users/user/Documents/R/win-library/3.6
[2] D:/Program Files/R/R-3.6.3/library