t-kalinowski / deep-learning-with-R-2nd-edition-code

Code from the book "Deep Learning with R, 2nd Edition"
https://blogs.rstudio.com/ai/posts/2022-05-31-deep-learning-with-r-2e/
41 stars 18 forks source link

package installing error! #1

Closed yuanping-Zhou closed 2 years ago

yuanping-Zhou commented 2 years ago

hello,Tomasz, I am a student from China, I am curious about practice things about “deep learning” by R follow your code. But unfortunately, When i tried to install the "tensorflow","keras-tuner",etc by runing the following codes: "if (tensorflow:::is_mac_arm64()) { reticulate::install_miniconda() keras::install_keras(extra_packages = c("ipython")) reticulate::py_install(c("keras-tuner", "kaggle"), envname = "r-reticulate", pip = TRUE)

} else { python <- reticulate::install_python("3.9:latest") reticulate::virtualenv_create("r-reticulate", python = python)

keras::install_keras(extra_packages = c("keras-tuner", "ipython", "kaggle")) reticulate::py_install( "numpy", envname = "r-reticulate", pip = TRUE, pip_options = c("--force-reinstall", "--no-binary numpy") ) }".

Then i meet the error message as follows "Error: Error installing package(s): "\"tensorflow==2.9.*\"", "\"tensorflow-hub\"", "\"scipy\"", "\"requests\"", "\"Pillow\"", "\"h5py\"", "\"pandas\"", "\"pydot\"", "\"keras-tuner\"", "\"ipython\"", "\"kaggle\"" In addition: Warning message: In shell(fi, intern = intern) : 'C:\Users\Allen520\AppData\Local\Temp\RtmpS6xkGK\file68449cc308a.bat'运行失败,错误码为2"

I don't know what to do next and has no idea how to solve such problem, would you mind helping me to find solution ?

t-kalinowski commented 2 years ago

Hi @yuanping-Zhou! Happy to help. Can you give tell me the output of sessionInfo() and reticulate::py_config()?

yuanping-Zhou commented 2 years ago

Thank you very much, they are as below:

sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] Rcpp_1.0.8.3 here_1.0.1 lattice_0.20-45 png_0.1-7
[5] rprojroot_2.0.3 withr_2.5.0 zeallot_0.1.0 rappdirs_0.3.3
[9] grid_4.1.2 R6_2.5.1 jsonlite_1.8.0 magrittr_2.0.3
[13] rlang_1.0.2 tfruns_1.5.0 cli_3.3.0 remotes_2.4.2
[17] whisker_0.4 Matrix_1.3-4 generics_0.1.2 reticulate_1.25
[21] keras_2.9.0.9000 tools_4.1.2 compiler_4.1.2 base64enc_0.1-3
[25] tensorflow_2.9.0.9000

reticulate::py_config() python: C:/Users/Allen520/AppData/Local/r-reticulate/r-reticulate/pyenv/pyenv-win/versions/3.9.13/python.exe libpython: C:/Users/Allen520/AppData/Local/r-reticulate/r-reticulate/pyenv/pyenv-win/versions/3.9.13/python39.dll pythonhome: C:/Users/Allen520/AppData/Local/r-reticulate/r-reticulate/pyenv/pyenv-win/versions/3.9.13 version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] Architecture: 64bit numpy: [NOT FOUND] tensorflow: [NOT FOUND]

yuanping-Zhou commented 2 years ago

oh, one possible problem is that my dell computer do not use the nividia "cuda drivers" and only equiped with "Intel(R) iris(R) Plus Graphics" instead. But i think this shouldn't be the reason that i cannot practice "deep learning" in my computer!

t-kalinowski commented 2 years ago

Missing or incorrect CUDA drivers would only raise a warning on load, they shouldn't stop installation from succeeding. I think the issue is that you have two "r-reticulate" environments, one installed by pyenv with reticulate::install_python(), and another installed by miniconda with reticulate::install_miniconda(). install_keras() is picking the miniconda one at installation time, but then reticulate binds to the pyenv one when you try to initialize reticulate.

I think the solution is to start from a blank slate and uninstall the previously installed pythons.

reticulate:::rm_all_reticulate_state()

(On Linux and Mac I recommend pyenv typically, but on Windows there is currently a pyenv bug that prevents me from recommending it.)

Then, install miniconda and keras:

reticulate::install_miniconda()
keras::install_keras()
yuanping-Zhou commented 2 years ago

Mnay thanks for your generous help,This morning,I followed your advice, it works Ok. @t-kalinowski