2017-10-18 27 views
3

R 3.4.2를 사용 중입니다. 나는 코드의 decryptrpackageR에 오류 : 모델을 저장하고로드하는 데 h5py Python 패키지가 필요합니다.

library(decryptr) 

# Download captchas 
captcha <- download_tjmg(dest = 'img') 
keras_tjmg <- decryptrModels::read_model('tjmg') 

마지막 줄에서 예를 다음 있어요 내가 터미널에서 패키지를 h5py 다시 시도

Error in keras::load_model_hdf5(file_path) : 
    The h5py Python package is required to save and load models 

오류를 생성합니다. 나는 또한 keras 꾸러미를 설치했다. 내가 pyrthon에서 h5py 패키지를 가져올 수 있지만 Rstudio는 어떻게 든 그것을 인식하지 못합니다.

+0

아나콘다를 사용하고 있습니까? 나는이 문제를 한 번 겪었고 h5py 내부 (r-tensorflow) 환경에 pip를 설치하여 해결했습니다. – Athos

답변

1

전에 이러한 패키지를 설치 한 적이 없지만 다음과 같이 진행하고 성공했습니다! 그것은 당신이보고 한 것 외에 다양한 오류를 주었기 때문에 약간의 시간도 걸렸습니다.

마지막으로, 나는이 함께했다 : 터미널에서,

내가 파이썬에서 확인
pip uninstall h5py 
pip install h5py 
pip uninstall keras 
pip install keras 

import h5py 실행 사실 (. 처음으로, 그것은 나에게 DLL 실패했다) 것을 그리고 R에, 다시 시작한 후,

install.packages("reticulate") 
install.packages("tensorflow") 
install.packages("keras") 
install.packages("h5py") 
devtools::install_github("decryptr/decryptr") 
devtools::install_github("decryptr/decryptrModels") 

library(keras) 
install_keras() 

# Check where Python's looked for 
reticulate::py_config() 

library(decryptr) 
library(decryptrModels) 

captcha <- captcha_download_tjmg(dest = 'img') 
keras_tjmg <- read_model('tjmg') 

sessionInfo()는 다음과 같다 :

R version 3.4.1 (2017-06-30) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows >= 8 x64 (build 9200) 
Matrix products: default 
locale: 
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252 
[3] LC_MONETARY=English_United States.1252 
[4] LC_NUMERIC=C       
[5] LC_TIME=English_United States.1252  
attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  
other attached packages: 
[1] decryptrModels_0.0.0.9000 decryptr_0.0.1.9000  
[3] keras_2.0.8.9001   
loaded via a namespace (and not attached): 
[1] Rcpp_0.12.13   prettyunits_1.0.2  assertthat_0.2.0  
[4] R6_2.2.2    jsonlite_1.5   magrittr_1.5   
[7] httr_1.3.1   tfruns_1.0   rlang_0.1.2   
[10] progress_1.1.2  curl_2.8.1   whisker_0.3-2   
[13] reticulate_1.2.0.9005 tools_3.4.1   purrr_0.2.3   
[16] compiler_3.4.1  base64enc_0.1-3  tensorflow_1.4.0.9003 

은 KN 나를 보자 이런 일이 있다면