reticulate
Install python in r step by step
Create environment
library(reticulate)
conda_create(envname = 'D:/python/env/r-reticulate', python_version = '3.6.13')
Edit .Rprofile
# usethis::edit_r_profile()
# Sys.setenv(RETICULATE_PYTHON = 'D:\\python\\env\\r-reticulate\\') # version 3.6
Install python package
Default environment
<- "D:\\python\\envs\\r-reticulate" my_env
Install packages using conda
::conda_install(envname = my_env, packages = "lightgbm") reticulate
Install packages using pip
::py_install(packages = "xgboost", envname = my_env) reticulate
Extra
install miniconda if needed
::install_miniconda(path = "D:/python/")
reticulate::miniconda_update(path = "D:/python/") # update if needed reticulate
check python version
::py_version()
reticulate::py_versions_windows() reticulate
check config
::py_config()
reticulate::py_discover_config() reticulate
check conda envs
::conda_list()
reticulate# conda_remove("pillow")
::virtualenv_list() reticulate
convert to rmd
:::convert_ipynb("python/volatility-prediction.ipynb") rmarkdown