How can I install knitr in Rhel8 - r

Seeing below error while trying to install knitr_1.2.tar.gz This is on RHEL 8 and R version 3.4.3. Installing a old version of the package to satisfy user requirement.
R CMD INSTALL knitr_1.2.tar.gz
* installing to library ‘/opt/R/3.4.3/lib/R/library’
* installing *source* package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Error : object ‘tidy.source’ is not exported by 'namespace:formatR'
ERROR: lazy loading failed for package ‘knitr’
* removing ‘/opt/R/3.4.3/lib/R/library/knitr’

knitr 1.2 was released in 2013, and personally I strongly discourage your user from using such an old version. I'd like to know why they have to use it before trying to install it. If they must use it, this version of knitr requires formatR::tidy.source to be available, which in turn requires a very old version of formatR (before v1.0), because this function has been deprecated in formatR v1.0 and removed in v1.4. You may try to install formatR v0.10 before installing knitr v1.2. Again, strongly not recommended.

Related

R install package tabplot

When I install R package, tabplot, below message has come.
My R version has updated 4.0.4 because 4.0.2 had same error.
error message is below)
Warning in install.packages :
package ‘tabplot’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Could you pls share how to resolve this issue?
Let's go meta for a moment:
What are you trying to do? Do you have a particular function in that archived package that you are hoping to apply to your dataset? ( which would imply that we needed to know which function. ... and a bunch of other questions.)
Or is this an effort to follow a blog or tutorial from the Web? (Again which one?)
I see this when I execute:
> install.packages("tabplot")
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘tabplot’ is not available (for R version 3.6.3)
So at this point my guess is that the tabplot maintainer has not keep pace with the evolution of R. Because ... packages that depend on the syntax or the behavior of core R functions or the CRAN rules that might change over time depending on the considered decisions of the R Core and CRAN. That's just the way it is. There's a further sort of language/system evolution that Hadley spawned.(ggplot and magrittr/ddplyr/rlang). (Arguably the S4 tributary is in the same category. The last CRAN-accepted version was downloadable from: <search-for exact URL> at 'an URL to be named later"' produces "Archived on 2020-02-19 as check problems were not corrected despite reminders." So that's pretty recent. Perhaps we can just download a copy of the most recent "tabplot-xx.xx.xx.xx.tar.gz" file from the CRAN archive and install from local source. (Note: need to use repo=NULL in the install.packages call.)
Well, that's not working yet because of an unmet dependency on an object named clone from package:ff.
install.packages("~/Downloads/tabplot/", repos =NULL)
#--------------
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘tabplot’ ...
** package ‘tabplot’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error: object ‘clone’ is not exported by 'namespace:ff'
Execution halted
ERROR: lazy loading failed for package ‘tabplot’
* removing ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/tabplot’
So perhaps you can live with some drop-in R code from the expanded source on the CRAN Archive?
EDIT: So I tried figuring out how to handle that sort of error and finally decided to try changing the NAMESPACE file. It's a text file that names various functions and where the program should find them. The two lines I needed to change were the ones importing ff:::clone and ff:::is.factor.ff so change them to
importFrom(bit, clone) # the bit package has an exported version
importFrom(ff, is.factor) # removed the `.ff` from its name
And now I get:
install.packages("~/Downloads/tabplot/", repos =NULL)
Installing package into ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘tabplot’ ...
file ‘NAMESPACE’ has the wrong MD5 checksum
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tabplot)
The warning message is because I edited the NAMESPACE file but didn't do a full rebuild. Also note that you will not need the Rtools on a Windoze machine or the XCode and CLT on a Mac because there is no compiled code in this package.
It does appear that most of my efforts are paralleling the changes being made to the github version. See https://github.com/mtennekes/tabplot/issues/21 where the is.factor.ff issue was addressed 2 days ago. The author/maintainer says the package will be resubmitted to CRAN.
Despite claims that resubmission will occur. there does not seem to be any progress on that front. https://cran-archive.r-project.org/web/checks/2020/2020-02-19_check_results_tabplot.html However the github page suggests an installation via devtools and that succeeds for version 1.4.1 on an Ubuntu machine, despite the reports of errors in the earlier version that had been submitted to CRAN.

I can't install 'loadR' (climate4R) from github in R

I use Windows 10 and the version of R is 4.0.2. I have tried with Windows and Ubuntu but the problem is the same. Also with other versions of R (3.6.1 and 3.6.3).
The message about the error is as follows:
* installing *source* package 'loadeR' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package 'climate4R.UDG' 0.1.1 was found, but >= 0.2.0 is required by 'loadeR'
Ejecución interrumpida
ERROR: lazy loading failed for package 'loadeR'
What could be the solution?
Thank you!
Uninstalling the packages then installing from github appears to overcome this issue. E.g.
library(devtools)
install_github(c("SantanderMetGroup/loadeR.java",
"SantanderMetGroup/loadeR",
"SantanderMetGroup/climate4R.UDG",
"SantanderMetGroup/transformeR",
"SantanderMetGroup/visualizeR",
"SantanderMetGroup/downscaleR"))
I know this is an old thread, but just in case someone else has the same issue:
It wouldn't install for me either, so I went to:
https://www.oracle.com/java/technologies/javase-jdk13-downloads.html
and chose the 'Oracle jdk' download and then chose the appropriate Java product to download, then the code below was successful installing:
install.packages(“devtools”)
library(devtools)
install_github(c("SantanderMetGroup/loadeR.java",
"SantanderMetGroup/climate4R.UDG",
"SantanderMetGroup/loadeR",
"SantanderMetGroup/transformeR",
"SantanderMetGroup/visualizeR",
"SantanderMetGroup/downscaleR"))

Error installing packages using renv::restore()

I have a problem using renv. For a larger project we want to use renv to all have the same version of r and all our packages. Yet, as soon as a newer version of a package is available and we run renv::restore() we get an error like the following (please note: rcpparmadillo is not the only package. It also happens with greybox, mime, stringi and many more).
Error installing package 'RcppArmadillo':
=========================================
* installing *source* package 'RcppArmadillo' ...
** Package 'RcppArmadillo' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
Warning in system(paste(cmd, "shlib-clean")) 'make' not found
Warning in system(cmd) 'make' not found
ERROR: compilation failed for package 'RcppArmadillo'
* removing 'C:/Users/..../renv/staging/1/RcppArmadillo'
Error: install of package 'RcppArmadillo' failed
I now have two questions:
How can I fix this error?
How can we use the same versions of packages throughout our team if renv crashes everytime a newer version is available?
Thank you.
Lizzie
The ultimate issue here is that renv is trying to install these packages from sources, as binaries for these older packages are no longer available from CRAN. There are two potential solutions to this issue:
Consider using a MRAN checkpoint as your R repository. The plus side is that binaries for these older packages will remain available; the downside is that you won't be informed if newer packages do become available.
Install the requisite software so you can build these packages from sources.
For 2. on Windows, you will need to install Rtools:
https://cran.r-project.org/bin/windows/Rtools/
You can also use the renv::equip() function to download a variety of libraries needed to compile some packages from sources (for example, nloptr).

hisafer installation - how do I solve hard-coded installation path?

I am installing the hisafer package (for biophysical modeling) following instructions from author(s) lead by Kevin Wolz:
install.packages("devtools")
devtools::install_github("kevinwolz/hisafer")
here I got the answer:
...
write_param_file html
write_weather html
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
ERROR: hard-coded installation path: please report to the package maintainer and use '--no-staged-install'
* removing 'C:/Users/houska/Documents/R/R-3.6.0/library/hisafer'
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/houska/AppData/Local/Temp/RtmpI5hUAl/file32dc572b4098/hisafer_1.4.14.tar.gz’ had non-zero exit status
the following commands do not work, then:
library(hisafer)
vignette("hisafer-vignette")
What should I do to solve this problem?
This is related to the staged installation of packages introduced with R 3.6.0. You can disable it by passing the --no-staged-install option to R CMD INSTALL (as suggested by the error message):
devtools::install_github("kevinwolz/hisafer", INSTALL_opts="--no-staged-install")

ERROR: a 'NAMESPACE' file is required

I am trying to install some R packages on a Linux machine using
R CMD INSTALL -l <ourRlibrarylocation> <path where I saved the packagename.tar.gz file>
and I see an error message:
ERROR: a 'NAMESPACE' file is required
I am using R 3.0.1. Please help, I am new to R and just downloaded these packages for customers.
One example:
R CMD INSTALL -l /abcde/R/R-3.0.0/library /home/RFILES/PKG/UScensus2000tract_0.03.tar.gz
* installing *source* package âUScensus2000tractâ ...
ERROR: a 'NAMESPACE' file is required
* removing â/abcde/R/R-3.0.0/library/UScensus2000tractâ
According to the R documentation for writing extensions, all packages destined for version 3.0.0 and later must contain a NAMESPACE file. If you download an R package that gives you the above error, here's what you should try:
Untar the package:
tar -xvf the_package.tar.gz
Add a NAMESPACE file with the line exportPattern( "." ):
cd the_package
echo 'exportPattern( "." )' > NAMESPACE
cd ..
Re-tar the package:
tar -zcf the_package.tar.gz the_package
Try and install it again.
Hope that helps.
I actually just hit the same thing when compiling R-3.0.1. It looks to be that the package version that I was using was out of date. This was for proto:
# /var/local/R-3.0.1/bin/R CMD INSTALL -l /var/local/R-3.0.1/lib64/R/library proto_0.3-9.2.tar.gz
* installing *source* package ‘proto’ ...
ERROR: a 'NAMESPACE' file is required
* removing ‘/var/local/R-3.0.1/lib64/R/library/proto’
But there was a newer version for proto (0.3-10) which worked fine:
# ../var/local/R-3.0.1/bin/R CMD INSTALL -l ../var/local/R-3.0.1/lib64/R/library proto_0.3-10.tar.gz
* installing *source* package ‘proto’ ...
** package ‘proto’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘proto.Rnw’
‘protoref.Rnw’
** testing if installed package can be loaded
* DONE (proto)
I had an older install of R (2.15), which the older proto package worked with:
# /var/local/R-2.15.0/bin/R CMD INSTALL -l /var/local/R-2.15.0/lib64/R/library proto_0.3-9.2.tar.gz
* installing *source* package 'proto' ...
** Creating default NAMESPACE file
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
'proto.Rnw'
'protoref.Rnw'
** testing if installed package can be loaded
It looks like the older version of R actually creates the missing NAMESPACE file, but the new version bails. Hope this helps you!
I found the following link more useful:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
6. The package is out of date
It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).
In this case, you can load an old version of the package using install_version()
library(devtools)
install_version("foobarbaz", "0.1.2")
An alternative is to install from the github CRAN mirror.
library(devtools)
install_github("cran/foobarbaz")
One can now use remotes::install_url() or remotes::install_local().
It installs dependencies and generates the NAMESPACE file automatically.

Resources