Difference between revisions of "Installing RPackages as Bundle"

From HPC users
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
The Easyconfig below is an example, it was created for the ticket mentioned above. The basics are more or less self-explaining. The exts_default_options are set to download sources from CRAN, the exts_filter is used to build the command for testing if an extension is already installed (when you use --skip --force to only install missing extensions). The extension list might not be complete in the beginning resulting in errors:
The Easyconfig below is an example, it was created for the ticket mentioned above. The basics are more or less self-explaining. The exts_default_options are set to download sources from CRAN, the exts_filter is used to build the command for testing if an extension is already installed (when you use --skip --force to only install missing extensions). The extension list might not be complete in the beginning resulting in errors:
  ERROR: dependency Cubist is not available for package C50
  ERROR: dependency Cubist is not available for package C50
In such a case you can use the command (needs nicer formating):
In such a case you can use the command <tt>Rdependencies</tt> which is this script:
for x in $(echo Cubist | tr ',' ' '); do v=$(R -q -s --no-save -e "library('versions'); available.versions('$x')" | awk '{if ($1==1) print $2}'); echo "    ('$x', '$v', {"; echo "    }),"; done
<pre>
#!/bin/bash
 
function die {
  echo $@
  exit 1
}
 
which R &> /dev/null || die "You need to the R for which the dependecies will be installed."
 
for x in $(echo "$@" | tr ',' ' ')
do
  v=$(R -q -s --no-save -e "library('versions'); available.versions('$x')" | awk '{if ($1==1) print $2}')
  echo "    ('$x', '$v', {"
  echo "    }),"
done
</pre>
and can be used e.g as this:
$ Rdependencies Cubist
to print the two lines needed to be added to the Easyconfig, in this case:
to print the two lines needed to be added to the Easyconfig, in this case:
     ('Cubist', '0.2.3', {
     ('Cubist', '0.2.3', {

Latest revision as of 15:59, 13 July 2020

RPackage extensions

The list of extensions for R is already quite large by default, so adding more extension might not always be a good idea and difficult to maintain. Instead, creating a bundle-Easyconfig with an extension list could be a better solution. This is also required if an RPackage has an additional dependency, e.g. for pdftools you need the module poppler (see below). Also, if several extensions belonging together are requested by a user (see ticket 20200629-0179) than an Easyconfig serves as a documentation and the same setup can be provided for another R version easily.

The Easyconfig below is an example, it was created for the ticket mentioned above. The basics are more or less self-explaining. The exts_default_options are set to download sources from CRAN, the exts_filter is used to build the command for testing if an extension is already installed (when you use --skip --force to only install missing extensions). The extension list might not be complete in the beginning resulting in errors:

ERROR: dependency Cubist is not available for package C50

In such a case you can use the command Rdependencies which is this script:

#!/bin/bash

function die {
   echo $@
   exit 1
}

which R &> /dev/null || die "You need to the R for which the dependecies will be installed."

for x in $(echo "$@" | tr ',' ' ')
do
   v=$(R -q -s --no-save -e "library('versions'); available.versions('$x')" | awk '{if ($1==1) print $2}')
   echo "    ('$x', '$v', {"
   echo "    }),"
done

and can be used e.g as this:

$ Rdependencies Cubist

to print the two lines needed to be added to the Easyconfig, in this case:

   ('Cubist', '0.2.3', {
   }),

Just cut'n'paste before the package that is missing the dependency (order is important). Multiple deps can be feed into the command in a comma-separated list (copy from log file). After that, add checksums and try installing again:

eb --inject-checksum sha256 --force quanteda-2.1.0-foss-2019b-R-4.0.2.eb
eb83 --force --skip quanteda-2.1.0-foss-2019b-R-4.0.2.eb

then rinse and repeat.

If you get other errors than missing deps, it probably means a module dependency is needed.

easyblock = 'Bundle'

name = 'quanteda'
version = '2.1.0'
versionsuffix = '-R-%(rver)s'

homepage = 'http://quanteda.io'
description = "An R package for managing and analyzing text."

toolchain = {'name': 'foss', 'version': '2019b'}

dependencies = [
    ('R', '4.0.2'),
    ('poppler', '0.90.0'),
]

exts_defaultclass = 'RPackage'

exts_default_options = {
    'source_urls': [
        'https://cran.r-project.org/src/contrib/Archive/%(name)s',  # package archive
        'https://cran.r-project.org/src/contrib/',  # current version of packages
        'https://cran.freestatistics.org/src/contrib',  # mirror alternative for current packages
    ],
    'source_tmpl': '%(name)s_%(version)s.tar.gz',
}

exts_filter = ("R -q --no-save", "library(%(ext_name)s)")

exts_list = [
    ('RcppParallel', '5.0.2', {
        'checksums': ['8ca200908c6365aafb2063be1789f0894969adc03c0f523c6cc45434b8236f81'],
    }),
    ('proxyC', '0.1.5', {
        'checksums': ['e63dc4f20d16c27404cc5aad5b6f0478c7b1e347cc25988735156ad205612b95'],
    }),
    (name, version, {
        'checksums': ['877504c7b075396fd1d2fe1377d5f538bbc9b17c292c24290b0d64f3caa9bb63'],
    }),
    ('LiblineaR', '2.10-8', {
        'checksums': ['0f81a93bb954d71fc65c6487da581423b7053722e97544fb1260c7c3d457d39f'],
    }),
    ('RSpectra', '0.16-0', {
        'checksums': ['aaf1cfc9ffe3a4c6684247899924e1c18306971dfef4bae1dc596a2fb42a64a9'],
    }),
    ('RSSL', '0.9.1', {
        'checksums': ['2841483cd7f890737ff79839d222552c2e796cab2848f63aea11a469e7578520'],
    }),
    ('quanteda.textmodels', '0.9.1', {
        'checksums': ['d64e72f4eb7c43008c8b8b7e7ee8b9d18b26b1065c05a043a806746f261c8411'],
    }),
    ('antiword', '1.3', {
        'checksums': ['d248f8117c8b96ee56459eb08c078295aca5c72ee78f1ce2438bf3f4c0b29f0c'],
    }),
    ('qpdf', '1.1', {
        'checksums': ['71f106925aeffcf3cae500aad5f9306b64a9ed963540ec1d77a161c49975960e'],
    }),
    ('pdftools', '2.3.1', {
        'checksums': ['5d373b46acc226f7dfe41f0617876d84fe394fdc999e4a3fd011ea29ab782506'],
    }),
    ('readODS', '1.6.7', {
        'checksums': ['41f9c05c906673d044ec4f1156a5d82fc34002797d29b14b68879a38b68473db'],
    }),
    ('ndjson', '0.8.0', {
        'checksums': ['22a037dbad0ae17e0ac442f45370fa7b4c4cc23f66ef1a949fe4e910dd5b7f53'],
    }),
    ('streamR', '0.4.5', {
        'checksums': ['3d1e496b387802c0f21f1b6f29fac0a4d8c2f189d3505b6dc8251421c11a9db2'],
    }),
    ('striprtf', '0.5.2', {
        'checksums': ['8df187eafaa80c12317e3be3a7b4fe20ac4a89d0e91b21756ee645aaa85246e5'],
    }),
    ('readtext', '0.76', {
        'checksums': ['92d3335b7b19cd1cc8298615e28fb0174c6ef9410d3351567b2578a5c46ae9cc'],
    }),
    ('tau', '0.0-21', {
        'checksums': ['a7fbd884eba0c49feb72c1c8614d70e65038781eebd7bfd9a5ac18b42fa08e23'],
    }),
    ('RTextTools', '1.4.3', {
        'checksums': ['ffd34254d07a2aad27d8dd5cfd877b3fc9ffa94771fd8e6c36609ac170dcb23b'],
    }),
    ('udpipe', '0.8.3', {
        'checksums': ['60b1cfefcb7406825bfc352c002a8c84c56dda565253713e997d40008ed644fb'],
    }),
    ('irr', '0.84.1', {
        'checksums': ['e7bae8476b723a2246564c013194e8b7fcc9b34affc0ab5fcd55875231f544c3'],
    }),
    ('KernelKnn', '1.1.0', {
        'checksums': ['172c99d71bfd07db018053051952a22cbaa806592df7284e9f00ae82c52213f1'],
    }),
    ('dbscan', '1.1-5', {
        'checksums': ['135eebfff327631e4e4b98119405e3550d096b882578f64b39425955ab4d02ee'],
    }),
    ('smotefamily', '1.3.1', {
        'checksums': ['978d99afaf1bfe51d1752f652298a5e2e1fde2f667e10f8373dee2158ebe5e18'],
    }),
    ('Cubist', '0.2.3', {
        'checksums': ['19845f585e073f316bb4bdf74b28a624e839561faeedd40ef5548960c5b1e1f4'],
    }),
    ('C50', '0.1.3.1', {
        'checksums': ['0b151ba8deef50ab2e2ad8469d87f54f0c6ab862f5c790ed8bb16cb3b8027546'],
    }),
    ('imbalance', '1.0.2.1', {
        'checksums': ['3a44ee386faac9a08d09f9e8df48689aa9d635e1e35aefb40a0b0584fab8c791'],
    }),
]

sanity_check_paths = {
    'files': [],
    'dirs': [name],
}

modextrapaths = {'R_LIBS': ''}

moduleclass = 'math'