Error while installing package
Hello, I have encountered this error while trying to install qrcode on my Ubuntu computer via CRAN (install.packages("qrcode")).
Installing package into ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/qrcode_0.3.0.tar.gz'
Content type 'application/x-gzip' length 42378 bytes (41 KB)
==================================================
downloaded 41 KB
* installing *source* package ‘qrcode’ ...
** package ‘qrcode’ successfully unpacked and MD5 sums checked
** using staged installation
** R
Error in parse(outFile) :
/tmp/RtmphEuurz/R.INSTALL712767cb85f5/qrcode/R/qr_vcard.R:130:51: unexpected input
129: gsub(pattern = "\\\\", replacement = "\\\\\\\\", x = x) |>
130: gsub(pattern = ",", replacement = "\\,", x = _
^
ERROR: unable to collate and parse R files for package ‘qrcode’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.1/qrcode’
Warning in install.packages :
installation of package ‘qrcode’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpGPdyuL/downloaded_packages’
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=zh_CN.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2 rstudioapi_0.15.0
It seems like the R version you are using it too old. Can you try installing it in a more recent version?
Hello Thierry, yes indeed when I tried it on R-4.3.0 (on Ubuntu), it installed without a problem.
I just hit this on an Ubuntu (22.04 LTS) EC2 image because apt there installs R 4.1.2 (admittedly very out of date). This should be caught a bit earlier; using the placeholder _ on the right hand side of the native pipe like this
https://github.com/ThierryO/qrcode/blob/713f72e3b21ffa7c91f7faad5afb4e9d9a0b65d9/R/qr_vcard.R#L130
requires R>=4.2.0, so I believe that should be the minimum required version for {qrcode}, in which case the correct behaviour of failing to attempt to install on 4.1.2 should result.
Yes. I should update that requirement. However, it seems to be a bit to small of an update to release a new version.