R CMD build: file DESCRIPTION does not exist - r

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.

Related

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)

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

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

R CMD check stops at "checking Rd cross-references"

I am using devtools::check(document=FALSE,args=c('--no-multiarch')) to perform the checks for my package.
When the above command performs R --vanilla CMD check "C:\sometmpfolder/mypackage.tar.gz" --timings --no-multiarch,
it stops at
* checking Rd cross-references ...
i.e., this is the last line in mypackage.Rcheck/00check.log. There is no error message - the check seems to freeze.
I use roxygen2 to create my documentation. The cross references that I use are of the form \link{somefunction} and \link[somepkg]{somefunction}.
I am running R 3.1.2 on a Win 7 machine.
But I think that I have seen a similar behaviour with earlier versions of R and without roxygen2 as well.
Do you guys know why the check stops at the cross-references?
It turned out that an incorrect statement of the form
\link[somepkg]{somefunction}
was the problem. In my case I used the incorrect command \link[reshape]{melt} although it should be \link[reshape2]{melt}.
This caused the Rd cross-reference check to take forever (actually, it finished after nearly one hour). After correcting to \link[reshape2]{melt} the Rd cross-reference check only took a minute or so.

When running check on an R package, what does the "use ‘--force’ to remove the existing ‘INDEX’" message mean?

When running R CMD check on an R package I often see the following message stating that the INDEX is not up to date:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking whether ‘INDEX’ is up-to-date ... NO
* use ‘--force’ to remove the existing ‘INDEX’
* installing the package to re-build vignettes
* creating vignettes ... OK
This does not result in an a Warning, Error or even a Note. I assume this is referring to the INDEX file in the top level of the package directory? How do I "use --force"? I've tried adding --force as a argument while building or checking and it just complains that it is not recognized. Is there an R command to rebuild the INDEX file?
Doh, of course I figured it out soon after posting. This still may be a useful question for other people since I didn't find relevant google hits:
It appears that if the --force argument should be given to R CMD build (not INSTALL or check) forcing the INDEX file to be deleted and regenerated. Also found the R function that generates the INDEX file:
tools::Rdindex("man/",outFile="INDEX")

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