Using RStudio's "Build" but no *.Rcheck generated - r

I've just started using RStudio's build check, and used it to make one package already. I've started on a second package, and this one is failing. As the build attempt happens, I get updates like:
* checking whether package ‘< package >’ can be installed ... ERROR
Installation failed.
See ‘/home/user/git/< package >.Rcheck/00install.out’ for details.
* DONE
Status: 1 ERROR
The problem is that the defined folder < package >.Rcheck doesn't exist, and neither do the files that are supposed to be in it (i.e. 00install.out, and 00check.log). Also, where I write < package >, the actual name of my package is shown instead.
I had folders view visible while the package was building, and I saw the .Rcheck folder appear, and then disappear shortly after. I was even able to browse the 000install.out file, but it had not yet encountered any errors.
It appears that the whole Rcheck folder is being removed when the build fails, leaving me with no trace of what caused the error.
Has anyone else experienced this? I'm using RStudio version 0.99.902 with R version 3.3.1 on Arch Linux.

My approach is the following one:
Go to 'Tools' -> 'Global Options' -> 'Packages' and then have a look, if 'View Rcheck directory after failed R CMD check' is ticked. You find other useful options there, too, e.g. 'Cleanup output after successful R CMD check'.

A little more detail on how to preserve error logs, based on the answer from #J_F. I needed to tick View Rcheck directory after failed R CMD check, because the cleanup occurs after the misleading message
See
‘.../yourpackage.Rcheck/00check.log’
for details.
I also needed to untick Cleanup output after successful R CMD check, because R CMD can succeed even when there are errors!
R CMD check results
1 error | 3 warnings | 2 notes
Warning messages:
1: `cleanup` is deprecated
2: Version of roxygen2 last used with this package is 6.0.1.9000. You only have version 6.0.1
R CMD check succeeded

Related

R: "internet routines cannot be loaded" when starting from RStudio

I am running Red Hat Enterprise Linux (RHEL) 8.5 with Linux kernel 4.18 and Gnome 3.32.2. In this system, I've got R 4.1.2 compiled with the tool asdf with shared libraries enabled. On top of that, I installed RStudio 2021.09.01-372 from an RPM from the official RStudio website.
When I start Rstudio, the first line of output after the usual R startup is an error:
Error in tools::startDynamicHelp() : internet routines cannot be loaded
I am unable to figure out what's causing this error, and with it I can't run things like refresh CRAN or update packages. But if I start a pure R session from the terminal (instead of Rstudio) this error does not occur.
Some things I tried:
Install the krb5 and libssh2 packages on my host system: Didn't help.
Starting a "pure" R session (both with and without the --vanilla argument) from the Terminal tab within Rstudio also gives this error. If I try to run update.packages() from this session, it pops up a window to select a CRAN mirror then fails with the following:
Warning: failed to download mirrors file (internet routines cannot be loaded); using local file '/home/[my username]/.asdf/installs/R/4.1.2/lib64/R/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
internet routines cannot be loaded
Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/home/penyuan/.asdf/installs/R/4.1.2/lib64/R/modules//internet.so':
/lib64/libssh.so.4: undefined symbol: EVP_KDF_ctrl, version OPENSSL_1_1_1b
But like I said, the strange thing is if I start an R session outside of Rstudio, these errors don't happen.
Within RStudio, the only workaround I can find is to run this command upon startup (suggested in this thread):
options(download.file.method="wget")
Once this is done, everything else seems to work, such as package updates.
However, I don't want to manually do this every time I start RStudio. So I tried to put it into ~/.Rprofile including a test print() as follows:
print("This is `~/.Rprofile`")
options(download.file.method="wget")
When I open RStudio, I can see the output from the print() call, but the options() command is not run because the original error shows up again. I still have to manually enter options(download.file.method="wget") every time.
I also tried to fold everything into a .First function in ~/.Rprofile as follows:
.First <- function() {
options(download.file.method="wget")
print("This is the `.First` function in `~/.Rprofile`")
}
Unfortunately, same result as before: print()'s output is seen, but options() is not run.
I also made sure that my ~/.Rprofile includes a trailing newline as discussed here. But this didn't help.
The above are the steps I've tried so far.
Why does this error only occur when running RStudio or a terminal within Rstudio? Why doesn't it happen if I start R from a terminal outside of Rstudio?
Is there a way to solve the problem so that the error doesn't happen in the first place? If it can't be solved, how do I set up my ~/.Rprofile so that options(download.file.method="wget") will be run?
Thank you.

R doesn't want to install packages and I can not change the working directory

Whenever I run RStudio and want to install packages, it gives me that: "Would you like to use your personal library instead?". If I pick "yes", it suggests me to create a personal library in my working directory. And then it fails to install:
Warning in install.packages : cannot create dir 'C:\Users\Name.Name-Name\OneDrive - ??? ?????? ????? ?????????', reason 'Invalid argument'
Error in install.packages : unable to create ‘C:/Users/Name.Name-name/OneDrive - ??? ?????? ????? ?????????/?????????/R/win-library/3.6’
When I run my R as administrator, packages install.
I have a Windows 10 OS, the source directory of my R and RStudio is "C\ProgrammFiles"
This problem has begun when I started using OneDrive service (as our uni provides us with 1 TB of cloud in OneDrive). Then I got really annoyed by OneDrive and deleted it. But the problem remained.
P. S.: I do not want always running RStudio as administrator — it takes a long time.
P. P. S.: "?????" in the error message is Cyrillic letters. I don't think that they are the cause of this particular problem because as administrator permission it works...

Workaround to allow badges in package README.md on github but not in CRAN version

R CMD check packagename_0.1.1.tar.gz --as-cran produces a WARNING if badges are present in README.md. This causes consequences like travis CI to fail (since it treats warnings as errors)
Is there a workaround to get the check to pass without removing the badges?
Here is an example of the WARNING I see
* checking top-level files ... WARNING
Conversion of ‘README.md’ failed:
pandoc: Could not fetch https://www.r-pkg.org/badges/version/bigrquery
TlsExceptionHostPort (HandshakeFailed (Error_Misc "user error (unexpected type received. expecting handshake and got: Alert [(AlertLevel_Fatal,HandshakeFailure)])")) "www.r-pkg.org" 443
Related: pandoc: Could not fetch http://www.r-pkg.org/badges/version/package TlsExceptionHostPort (HandshakeFailed
This is a workaround to embed (static) badges in pages. They do not auto-update. The purpose is to avoid offline derived errors.
Take a look at readme files in:
https://gitlab.com/ferroao/idiogramFISH. This also handles errors while installing with devtools in windows, a process that does not have online connectivity (see vignette index.Rmd). Look at DESCRIPTION also if you want to see dependencies and vignette builders.
Generate the .md from the .Rmd (Rmarkdown).
Months on, I discovered the problem. When I installed anaconda, it changed the version of pandoc my system used - which pandoc should return something like /usr/local/bin/pandoc (and not like /Users/st/anaconda3/bin/pandoc).
In my case, I edited by .bash_profile to exclude ananconda, closed and reopened the terminal and everything worked. (I also reinstalled pandoc from here, but I don't think that had anything to do with fixing it - it did show me the default installation location though)

R CMD build: file DESCRIPTION does not exist

After editing the DESCRIPTION file in a package I am developing, I am not able to use R CMD build anymore. R seems to be unable to read it.
Here is the error message:
$ R CMD build ~/projects/mypackage
* checking for file ‘/home/user/projects/mypackage/DESCRIPTION’ ... OK
* preparing ‘mypackage’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
Error in .read_description(ldpath) :
file 'mypackage/DESCRIPTION' does not exist
Execution halted
It is rather cryptic, isn't it ?
The file is here of course, and it is even found by R in the first line.
As you might expect, removing the DESCRIPTION file make the process fail on the first check:
$ R CMD build ~/projects/mypackage
* checking for file ‘/home/user/projects/mypackage/DESCRIPTION’ ... NO
Observations:
I tried to run it from another relative path (mypackage, .) without success.
It also failed on the CI server, and on a freshly cloned repository.
R CMD check ~/projects/mypackage runs without error as well as R -e "library(devtools); load_all();" (only a couple of unrelated warnings)
The only resource I have found is a similar bug affecting windows builds. I am not in this situation.
If I change the content of the Package field in DESCRIPTION to foo, without changing anything else, the error becomes Error in .read_description(ldpath) : file 'mypackage/DESCRIPTION' does not exist
There is a cleanup script deleting a bunch of files. Removing it does not solve the problem.
I am running:
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Platform: x86_64-pc-linux-gnu (64-bit) (Debian Jessie)
In my case, this .Rbuildignore would trigger error
^sccomp\.Rproj$
^\.Rproj\.user$
^\.github
^README*
^dev*
This would not
^sccomp\.Rproj$
^\.Rproj\.user$
^\.github
^README*
^dev
The difference is the asterisk after ^dev
If I can comment, this is shocking and made me waste 2 days. I'm wondering how can I notify R people
Comments the setwd line in my .Rprofile, and all errors gone, really saved my ass:
#setwd("~/.R/work")
I've been tortured a few days by this error:
Error in tools:::.read_description(file) :
file 'DESCRIPTION' does not exist
You can check out https://csgillespie.github.io/efficientR/set-up.html
a seemingly innocent call to setwd() in .Rprofile, for example, will break devtools build and check functions.

Julia: Problems with Adding Packages (BinDeps)

I am new to Julia's package manager, and I am having trouble installing GLPK and LinProgGLPK.
I have already run Pkg.Init() and have successfully installed Curl using Pkg.add("Curl"). However, when I try to install GLPK or LinProgGLPK (using Pkg.add("GLPK") and Pkg.add("LinProgGLPK")), I get the following message:
MESSAGE: Installing BinDeps v0.0.0
ERROR: Path BinDeps already exists! Please remove to allow installation.
in _resolve at pkg.jl:345
in anonymous at no file:163
in cd at file.jl:26
in cd_pkgdir at pkg.jl:42
in add at pkg.jl:143
in add at pkg.jl:175
I seem to get the same message for other packages that are dependent on BinDeps (including Winston).
I have tried calling Pkg.rm("BinDeps"), Pkg.add("BinDeps"), Pkg.update(), and Pkg.resolve(), and then returned to trying to add GLPK, but the same message persists. I have also entered ~/.julia to remove the BinDeps folder, but that did not work either. What am I missing?
P.S. I am running julia in Linux Ubuntu.
Honestly, when something gets screwed up, it's best just to wipe ~/.julia and re-add the packages.
Just make sure you back up your local changes!

Resources