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

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")

Related

Snakemake installing R package in rule environment: error cannot move 00LOCK permission denied

I'm writing a Snakemake pipeline with a rule that will run an R script. This rule has its own environment that looks like this:
channels:
- conda-forge
- r
- bioconda
dependencies:
- r-base = 4.1.1
- r-ggplot2 = 3.3.5
- r-biocmanager = 1.30.16
Next to the above packages, I also need ggbio, which can be installed with biocmanager:
if(!require(ggbio, quietly=TRUE)){ # if the package is not there, install it
BiocManager::install("ggbio")
}
When executing this rule via Snakemake, initially everything goes right, and most dependencies of the ggbio package get installed. However, after some while, I get the following error:
...
** R
** 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
** checking absolute paths in shared objects and dynamic libraries
mv: cannot move '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/00LOCK-xml2/00new/xml2' to '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/xml2': Permission denied
ERROR: moving to final location failed
ERROR: dependency ‘xml2’ is not available for package ‘biomaRt’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/biomaRt’
ERROR: dependency ‘biomaRt’ is not available for package ‘GenomicFeatures’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/GenomicFeatures’
ERROR: dependency ‘GenomicFeatures’ is not available for package ‘VariantAnnotation’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/VariantAnnotation’
ERROR: dependency ‘GenomicFeatures’ is not available for package ‘OrganismDbi’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/OrganismDbi’
ERROR: dependency ‘GenomicFeatures’ is not available for package ‘ensembldb’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/ensembldb’
ERROR: dependencies ‘GenomicFeatures’, ‘VariantAnnotation’, ‘ensembldb’ are not available for package ‘biovizBase’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/biovizBase’
ERROR: dependencies ‘biovizBase’, ‘VariantAnnotation’, ‘GenomicFeatures’, ‘OrganismDbi’, ‘ensembldb’ are not available for package ‘ggbio’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/ggbio’
The downloaded source packages are in
‘/tmp/RtmpiQdboR/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Old packages: 'fansi'
Warning messages:
1: In .inet_warning(msg) :
installation of package ‘xml2’ had non-zero exit status
2: In .inet_warning(msg) :
installation of package ‘biomaRt’ had non-zero exit status
3: In .inet_warning(msg) :
installation of package ‘GenomicFeatures’ had non-zero exit status
4: In .inet_warning(msg) :
installation of package ‘VariantAnnotation’ had non-zero exit status
5: In .inet_warning(msg) :
installation of package ‘OrganismDbi’ had non-zero exit status
6: In .inet_warning(msg) :
installation of package ‘ensembldb’ had non-zero exit status
7: In .inet_warning(msg) :
installation of package ‘biovizBase’ had non-zero exit status
8: In .inet_warning(msg) :
installation of package ‘ggbio’ had non-zero exit status
Error in library(ggbio) : there is no package called ‘ggbio’
Execution halted
The error seems to originate from this part:
mv: cannot move '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/00LOCK-xml2/00new/xml2' to '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/xml2': Permission denied
I get this error only when I run Snakemake from the Ubuntu app on my Windows. If I run it on the server, it works:
** R
** 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
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (xml2)
... (and then it continues to the other packages)
The versions are the same on the server and local, which is 1.3.3 for xml2. I've seen other questions relating to this lock issue (here and here), and most of them suggest doing something like this:
install.packages("Rcpp", dependencies = TRUE, INSTALL_opts = '--no-lock')
But this doesn't work for me because the package doesn't get installed with install.packages(). Adding options("install.lock"=FALSE) before the install also doesn't work. Also, when I check the R library folder in the environment location, I do not see the 00LOCK directory.
Any tips? Or is this just a Windows thing that's not easily fixable? Running the installment code in Rstudio does work, but I need the package to get installed in the conda environment, not my standard Rstudio library.
The YAML shown is substandard (incorrect channel order). But more importantly, it generally does not work well to install anything other than Conda packages in Conda-managed R environments. Fortunately, all Bioconductor packages are on the bioconda channel (usually with a bioconductor- prefix and all lowercase), hence, everything should work perfectly fine with simply:
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- r-base=4.1.1
- r-ggplot2=3.3.5
- bioconductor-ggbio

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.

R ggbiplot installation errer

I know this is a recurrent issue. However, going through all the hits when I google still has not helped me solve the issue. I hope someone can help: Her is what I do:
1: I run
install.packages('devtools')
library(devtools)
This appears to run all right. At least I do not get any error messages.
2: then I do:
install_github('vqv/ggbiplot', force=TRUE)
Then the errors messages comes:
install_github('vqv/ggbiplot', force=TRUE)
Downloading GitHub repo vqv/ggbiplot#master
√ checking for file 'C:\Users\jada\AppData\Local\Temp\RtmpgvAEpK\remotes28461c455b1\vqv-ggbiplot-7325e88/DESCRIPTION' ...
- preparing 'ggbiplot':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'ggbiplot_0.55.tar.gz'
Installing package into ‘C:/Users/jada/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing source package 'ggbiplot' ...
** using staged installation
** R
** data
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'ggplot2' was built under R version 3.6.1
Execution halted
ERROR: lazy loading failed for package 'ggbiplot'
* removing 'C:/Users/jada/Documents/R/win-library/3.6/ggbiplot'
Error: Failed to install 'ggbiplot' from GitHub:
(converted from warning) installation of package ‘C:/Users/jada/AppData/Local/Temp/RtmpgvAEpK/file28421d56f74/ggbiplot_0.55.tar.gz’ had non-zero exit status
If anyone could sort me out here, I would be very happy.
Thank you.
jd
I suggest you to go in the path of the library in your computer (should be c:/Users/jada/Documents/R/win-library/3.6/) and delete the ggbiplot folder. After this, redo the installation process.
In this way you remove every possible problem conflict.
If this doesn't work out try also to delete ggbiplot_0.55.tar.gz in the Temp folder as suggested in the error.
I know it is an old question, but I have found a solution in here, and just in case the link does not work, here is the possible solution:
install.packages("remotes")
remotes::install_github("vqv/ggbiplot")

Error in rbind(info, getNamespaceInfo(env, "S3methods")) when installing factoextra

I'm trying to install the "factoextra" package using a local source tar ball on Windows. I can install other packages in the same way with no problem. However, when installing "factoextra", I get an error relating to S3methods.
I have tried using local windows binaries, installing the latest Rtools and made sure I have all the dependencies installed. I have also tried to use archived versions of the package.
install.packages('D:\\R_Packages\\Packages\\factoextra_1.0.5.tar.gz', repos = NULL, type="source")
* installing *source* package 'factoextra' ...
** package 'factoextra' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package 'factoextra'
* removing 'D:/R-3.5.2/library/factoextra'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘D:/R_Packages/Packages/factoextra_1.0.5.tar.gz’ had non-zero exit status
I really just need this package to install.
I found this thread: http://r.789695.n4.nabble.com/Error-in-rbind-info-getNamespaceInfo-env-quot-S3methods-quot-td4755490.html, which leads me to how I solved a similar issue on my machine.
I found that a broken version of the package was installed on my system and had to be removed manually before I could install a clean version.
Find if and where factoextra is installed (it might be on your system, just outdated or broken):
find.package("factoextra")
If it's there already (just broken), you can try to remove it with:
remove.packages("factoextra")
If remove.packages() fails even though find.packages() says the package is there, use the path returned by find.packages() to use your OS' file system to find and delete the package - just be careful only to delete stuff you know is broken.
Once the old, broken package is removed, use install.packages("factoextra") and it should work.
I had several packages that were broken in this way. If that's the case for you, you can identify which packages to remove and install this way by using something like:
allPackages <- installed.packages()[, 1]
findBrokenPackages <- function(packages) {
for (p in packages) {
tryCatch(ncol(asNamespace(p)$.__NAMESPACE__.$S3methods),
error = function(e) print(c(p, e)))
}
}
findBrokenPackages(allPackages)
This will print out any packages that have the same issue. I would suggest removing all broken packages before trying to use install.packages() again.

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?
I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.
Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.
It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.
Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.
This is a bit hacky, but led to successful installation.
Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH
to R_HOME/etc/ldpaths.
I have solved this problem by install the ICU4C by source:
downloading ICU4C 58.2 from: ICU-Project
compiled
added the library location to $LD_LIBRARY_PATH,
the install will be work.

Resources