{"id":610,"date":"2018-08-20T23:34:54","date_gmt":"2018-08-20T22:34:54","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/htccondor\/?page_id=610"},"modified":"2019-05-09T12:22:51","modified_gmt":"2019-05-09T11:22:51","slug":"r_install_packages","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/software\/r_install_packages\/","title":{"rendered":"How to use additional R packages in HTCondor"},"content":{"rendered":"<p>There are two methods of deploying additional R packages for use in R jobs running on Condor:<\/p>\n<ol>\n<li>Pre-compiling the packages on the Condor submit node and distributing them with the job.<\/li>\n<li>Downloading, compiling and installing the R packages on-the-fly.<\/li>\n<\/ol>\n<h2>Using pre-compiled R packages<\/h2>\n<p>When using pre-compiled R packages it is essential that every <tt>install.packages()<\/tt> instruction in the R script is disabled. Otherwise R will attempt to re-compile the packages and fail, and then terminate with an error. If the R script needs to install even a single R package, for example, to optimize the code for the hardware on which the job is deployed then method 2 must be used.<\/p>\n<p><a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/fracdiff_precompiled.r\">R script using pre-compiled R package <tt>fracdiff<\/tt><\/a>:<\/p>\n<h3>Using R 3.2.4 with a pre-compiled package and submitting to Condor<\/h3>\n<ul>\n<li><tt>module load R\/3.2.4<\/tt><\/li>\n<li><tt>mkdir R32_packages<\/tt><\/li>\n<li><tt>export R_LIBS_USER=R32_packages<\/tt><\/li>\n<li><tt>R --no-save <<< 'install.packages(\"fracdiff\")'<\/tt><\/li>\n<li><tt>condor_submit submit_precompiled_R32.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_precompiled_R32.txt\">HTCondor submit file<\/a>.<\/p>\n<p>Note that the name of the R packages installation folder above (<tt>R32_packages<\/tt>) must match the folder name in the HTCondor submit file.<\/p>\n<h3>Using R 3.4.3 with a pre-compiled package and submitting to Condor<\/h3>\n<ul>\n<li><tt>module load R\/3.4.3<\/tt><\/li>\n<li><tt>mkdir R34_packages<\/tt><\/li>\n<li><tt>export R_LIBS_USER=R34_packages<\/tt><\/li>\n<li><tt>R --no-save <<< 'install.packages(\"fracdiff\")'<\/tt><\/li>\n<li><tt>condor_submit submit_precompiled_R34.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_precompiled_R34.txt\">HTCondor submit file<\/a>.<\/p>\n<p>Note that the name of the R packages installation folder above (<tt>R34_packages<\/tt>) must match the folder name in the HTCondor submit file.<\/p>\n<h3>Using R 3.5.3 with a pre-compiled package and submitting to Condor<\/h3>\n<ul>\n<li><tt>module load R\/3.5.3<\/tt><\/li>\n<li><tt>mkdir R35_packages<\/tt><\/li>\n<li><tt>export R_LIBS_USER=R35_packages<\/tt><\/li>\n<li><tt>R --no-save <<< 'install.packages(\"fracdiff\")'<\/tt><\/li>\n<li><tt>condor_submit submit_precompiled_R35.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_precompiled_R35.txt\">HTCondor submit file<\/a>.<\/p>\n<p>Note that the name of the R packages installation folder above (<tt>R35_packages<\/tt>) must match the folder name in the HTCondor submit file.<\/p>\n<h3>Using R 3.6.0 with a pre-compiled package and submitting to Condor<\/h3>\n<ul>\n<li><tt>module load R\/3.6.0<\/tt><\/li>\n<li><tt>mkdir R36_packages<\/tt><\/li>\n<li><tt>export R_LIBS_USER=R36_packages<\/tt><\/li>\n<li><tt>R --no-save <<< 'install.packages(\"fracdiff\")'<\/tt><\/li>\n<li><tt>condor_submit submit_precompiled_R36.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_precompiled_R36.txt\">HTCondor submit file<\/a>.<\/p>\n<p>Note that the name of the R packages installation folder above (<tt>R36_packages<\/tt>) must match the folder name in the HTCondor submit file.<\/p>\n<h2>Installing additional R packages on-the-fly<\/h2>\n<p>Installing R packages on-the-fly ensures that they can be optimized for the hardware on which the HTCondor job is run. However this will increase the time that R jobs take to complete as each additional R package will need to be downloaded, compiled and installed. <\/p>\n<p><a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/fracdiff_onthefly.r\">R script using on-the-fly installation of R package <tt>fracdiff<\/tt><\/a>:<\/p>\n<h3>Using R 3.2.4 with on-the-fly package installation and submitting to Condor<\/h3>\n<ul>\n<li><tt>condor_submit submit_onthefly_R32.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_onthefly_R32.txt\">HTCondor submit file<\/a>.<\/p>\n<h3>Using R 3.4.3 with on-the-fly package installation and submitting to Condor<\/h3>\n<ul>\n<li><tt>condor_submit submit_onthefly_R34.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_onthefly_R34.txt\">HTCondor submit file<\/a>.<\/p>\n<h3>Using R 3.5.3 with on-the-fly package installation and submitting to Condor<\/h3>\n<ul>\n<li><tt>condor_submit submit_onthefly_R35.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_onthefly_R35.txt\">HTCondor submit file<\/a>.<\/p>\n<h3>Using R 3.6.0 with on-the-fly package installation and submitting to Condor<\/h3>\n<ul>\n<li><tt>condor_submit submit_onthefly_R36.txt<\/tt><\/li>\n<\/ul>\n<p>using the following <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-content\/uploads\/submit_onthefly_R36.txt\">HTCondor submit file<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are two methods of deploying additional R packages for use in R jobs running on Condor: Pre-compiling the packages on the Condor submit node and distributing them with the job. Downloading, compiling and installing the R packages on-the-fly. Using pre-compiled R packages When using pre-compiled R packages it is essential that every install.packages() instruction in the R script is disabled. Otherwise R will attempt to re-compile the packages and fail, and then terminate with.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/software\/r_install_packages\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"parent":17,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-610","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/comments?post=610"}],"version-history":[{"count":19,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/610\/revisions"}],"predecessor-version":[{"id":730,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/610\/revisions\/730"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/17"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/media?parent=610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}