From e649b782d090324e7f8cccde4bfb79c02aa1d71e Mon Sep 17 00:00:00 2001 From: PiMarchal <166733270+PiMarchal@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:32:56 +0100 Subject: [PATCH 1/2] Create Install_python_function Function to install python and python packages with R (similar to what is done in the other quarto document) --- Install_python_function | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Install_python_function diff --git a/Install_python_function b/Install_python_function new file mode 100644 index 0000000..0a6b7ae --- /dev/null +++ b/Install_python_function @@ -0,0 +1,24 @@ +# Install python, and all python associated packages + +Install_python_spectriPy = function(PATH_miniconda = "~/miniconda3_reticulate",ENV_name = "r-reticulate"){ + print("Install reticulate prior to run this") + library(reticulate) + options(timeout = 600) + install_miniconda(path = PATH_miniconda,force = FALSE) + + use_python(paste(PATH_miniconda,"/bin/python3",sep = "")) + conda_create(ENV_name) + + py_install("matchms==0.28.2",pip = TRUE) + py_install("spectrum_utils",pip = TRUE) + py_install("numpy==2.0.2",pip = FALSE) + + conda_install(envname = ENV_name,"matchms==0.28.2",pip = TRUE,python_version = "3.12.2") + conda_install(envname = ENV_name,"spectrum_utils",pip = TRUE) + conda_install(envname = ENV_name,"numpy==2.0.2",pip = FALSE) + + print("R packages that needs to be installed for any analysis: BiocManager , Spectra , msdata , AnnotationHub , CompoundDb , GenomeInfoDbData , mzR , basilisk , SpectriPy") + print("Use the options(timeout = 600)") + print("WARNING: use_condaenv(paste(PATH_miniconda,ENV_name,'/bin/python3',sep ='') needs to be run after importing reticulate to tell it where to find the python environment") + return("Python installation finished") +} From b017fafc9fa071c0f6a012f4a20de4cd3b97e744 Mon Sep 17 00:00:00 2001 From: PiMarchal <166733270+PiMarchal@users.noreply.github.com> Date: Fri, 7 Feb 2025 09:21:43 +0100 Subject: [PATCH 2/2] Rename Install_python_function to inst/Script/Install_python_function.R Added to a new folder, as a .R file --- Install_python_function => inst/Script/Install_python_function.R | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Install_python_function => inst/Script/Install_python_function.R (100%) diff --git a/Install_python_function b/inst/Script/Install_python_function.R similarity index 100% rename from Install_python_function rename to inst/Script/Install_python_function.R