I am developing a package and consider including a vignette in it. I use RStudio for my package development and followed the instructions from Hadley Wickam to use Rmarkdown and knitr or writing the vignette.
I am able to compile the vignette when pressing knit from Rstudio but the command devtools::check() returns an error:
==> devtools::check(cleanup = FALSE)
Updating mypackage documentation
Loading mypackage
Setting env vars ---------------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS :-Wall -pedantic
Building mypackage ---------------------------------------------------------------
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file
--no-environ \ --no-save --no-restore --quiet CMD build \ '/Volumes/Stockage/Dropbox/R/Packages/mypackage' --no-resave-data \
--no-manual
* checking for file ‘/Volumes/Stockage/Dropbox/R/Packages/mypackage/DESCRIPTION’ ... OK
* preparing ‘mypackage’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to build vignettes
* creating vignettes ...
ERROR Error: processing vignette 'mypackage-vignette.Rmd' failed with diagnostics: It seems you should call rmarkdown::render() instead of knitr::knit2html() because mistral-vignette.Rmd appears to be an R Markdown v2 document.
Execution halted
Error: Command failed (1)
In addition: Warning message:
`cleanup` is deprecated
Execution halted
Exited with status 1.
What should I do or change ? I am aware it is only the check.
Session info:
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_2.1.0 foreach_1.4.3 knitr_1.14 rmarkdown_1.2
[5] mistral_2.2.1
The error message below was misleading, and has been fixed in a later version of knitr:
ERROR Error: processing vignette 'mypackage-vignette.Rmd' failed with diagnostics: It seems you should call rmarkdown::render() instead of knitr::knit2html() because mistral-vignette.Rmd appears to be an R Markdown v2 document.
What went wrong was not the vignette engine knitr::rmarkdown. This vignette was correct. The problem was that you have to also add rmarkdown (in addition to knitr) to Suggests in your package's DESCRIPTION file, otherwise during R CMD check, the rmarkdown package won't be available, hence knitr will fall back to knit2html() to build the vignette, but knit2html() sees an Rmd document that is supposed to be compiled by rmarkdown::render(), so it threw an error.
The vignette engine knitr::rmarkdown depends on rmarkdown, so rmarkdown needs to be present in Suggests in DESCRIPTION. Similarly, if the vignette engine requires other packages, these packages have to be specified as (hard or soft) dependencies of the package being checked.
The original answer to this question mentioned the vignette engine rmarkdown::render. This is not a valid vignette engine, and should not be used.
Related
I am trying to install the ProStaR and DAPAR packages with Rstudio (R version 3.6.3). Following the instructions from the instruction manual (https://www.bioconductor.org/packages/release/bioc/vignettes/DAPAR/inst/doc/Prostar_UserManual.pdf) after running the following code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version='3.10')
BiocManager::install("DAPAR")
BiocManager::install("Prostar")
library(Prostar)
Prostar()
I receive the following error messages:
>library(Prostar)
Error: package or namespace load failed for ‘Prostar’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
> Prostar()
Error in Prostar() : could not find function "Prostar"
When trying to separately install the shiny package:
install.packages("shiny")
library("shiny")
I get the same error message:
Error: package or namespace load failed for ‘shiny’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
I have to mention that I'm not extremely familiair with R yet. Any help would be greatly appreciated.
You did not include versions of several items in your setup so it's possible this comes from mismatching components (rather than my initial guess that it was due to a corrupt package from whatever mirror was being used.) I needed to upgrade to R 3.6.3 to match that aspect of your set up and in the process noted that Catalina OS users need a different version of R. I'm on Mojave, so my version now produces this on startup:
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
I then needed to update my BioConductor installation which was fairly quick but installing the DAPAR package takes a loooong time because of an extensive list of dependencies, some of which have unmet dependencies that required repeated attempts to get the process to completion. Then the Prostar package installation had another batch of unmet dependencies. After finally getting all the unmet dependencies installed, I'm unable to reproduce the error, so I'm thinking you should probably use another repository. I suggest first doing something like:
options(repos = "https://cloud.r-project.org/")
Or choose that mirror specification from the Rstudio setup panel. Then make another attempt.
I suppose it's possible that this issue arises because of a version mismatch of compilers. The CRAN page for MacOS says clang 7 is needed. In my setup I get this (in a Terminal window)
Comutername:~ myusername$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
And for gfortran I get:
GNU Fortran (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
I did all the R package installations from the R.app interface, so I suppose it's possible that some infelicity in Rstudio's package install process will be needed to explain this. Obviously all teh system installations such as clang and gfortran (and probably PROJ and other GIS packages) would need to be done from the Terminal command line. Sometimes it is safer to do all these installations from a minimal interface, possibly even from R running in a Terminal window. I've generally had good luck with R.app (over a span of 12 years) and less consistent results with Rstudio.
Ultimately I am attempting to install the R package ReporteRs (ReporteRs_0.8.7.tar.gz) on a Windows 7 system (session info, and other info below). This depends on the package ReporteRsjars (ReporteRsjars_0.0.2.tar.gz) which is where I am getting the install error.
This also depends on the R package rJava which is installed, along with JDK/JRE (jre1.8.0_112).
I am installing on a machine that has no internet access so I am doing this from a local version of CRAN with the PACKAGES and PACKAGES.gz built. This has been working without any issues (at least now it is).
rJava loads without any issues but when installing ReporteRsjars, I get the error below (see Install Attempt ERROR below).
NOTE: Other StackOverflow questions seem more focussed around library(rJava) having issues, not when installing a package dependent on rJava.
The rJava DLL is in the following location:
C:/Program Files/R/R-3.3.2/library/rJava/libs/x64/rJava.dll
This was reinstalled a number of times (successfully).
The sessionInfo and a more information is below the error (including what I tried).
Install Attempt ERROR
cran_dir_url is set to the path where the CRAN packages are located. This is prefixed with file://
> library(rJava)
> install.packages('ReporteRsjars', contriburl=cran_dir_url, repos = cran_dir_url, type = 'source')
## * installing *source* package 'ReporteRsjars' ...
## ** package 'ReporteRsjars' successfully unpacked and MD5 sums checked
## ** R
## ** inst
## ** preparing package for lazy loading
## ** help
## No man pages found in package 'ReporteRsjars'
## *** installing help indices
## ** building package indices
## ** testing if installed package can be loaded
## *** arch - i386
## Error : .onLoad failed in loadNamespace() for 'rJava', details:
## call: library.dynam("rJava", pkgname, libname)
## error: DLL 'rJava' not found: maybe not installed for this architecture?
## Error: loading failed
## Execution halted
## *** arch - x64
## ERROR: loading failed for 'i386'
## * removing 'C:/Program Files/R/R-3.3.2/library/ReporteRsjars'
## Warning in install.packages :
## running command '"C:/PROGRA~1/R/R-33~1.2/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.3.2\library" /Users/cirina_ext/Documents/StevenBanville/CRAN_Targeted/ReporteRsjars_0.0.2.tar.gz' had status 1
## Warning in install.packages :
## installation of package 'ReporteRsjars' had non-zero exit status
##
Environment Information & Tools
Path Info: The following is included in the system path and is where Java was installed.
C:\Program Files\Java\jre1.8.0_112\bin\;C:\Program Files\Java\jre1.8.0_112\bin\server\;%path%
(JDK Installer: jdk-8u112-windows-x64)
Rtools Version and Location
Version: 3.4.0.1962
Location: C:\Rtools
What I Tried
I started with attempting to install the ReporteRs R packages, and this installed all dependencies but failed on the ReporteRsjars package.
After installing the JDK/JRE, I reinstalled rJava (this was done a few times after various attempts to install the R package). All rJava installs were successful, and so was library(rJava).
I attempted to run the following command in a windows command window, as I have seen this recommended in a number of SO answers.
R CMD javareconf
'javareconf' is not recognized as an internal or external command, operable program or batch file.
I attempted to include the path to the rJava DLL in the path system variable but that did not work.
NOTE: I restarted the RGui and RStudio after each of these attempts (I tried in both of these environments). I also rebooted the machine.
I have done a lot of googling and looking at StackOverflow but all of the issues have found are not the same as this. They appear similar but after attempting a number of things, I still get the above error. I have omitted the links I looked at but can add them if that would help.
An guidance to help me troubleshoot and solve this would be appreciated.
Session Info
> sessionInfo('rJava')
## R version 3.3.2 (2016-10-31)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
##
## locale:
## [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## character(0)
##
## other attached packages:
## [1] rJava_0.9-8
##
## loaded via a namespace (and not attached):
## [1] graphics_3.3.2 tools_3.3.2 utils_3.3.2 grDevices_3.3.2 stats_3.3.2 datasets_3.3.2
## [7] methods_3.3.2 base_3.3.2
EDIT
I attempted the same install on a different machine with only the 64 bit version of Java (and confirmed it is 64 bit) and got the same error. Here is a snippet but it is the same as the above error:
...
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: library.dynam("rJava", pkgname, libname)
error: DLL 'rJava' not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
...
I am still looking at the link from the comment by #42-, but this doesn't look like an issue with the JRE/JDK not being 64 bit.
EDIT 2
Note: this is not posted as an answer since it is just a workaround.
I found a workaround which is not quite desirable. It seems the install from the local CRAN copy was not quite as similar as I had expected. I installed the problematic library install(s) on an equivalent Windows 7 machine using a NON-local CRAN (i.e. the usual way) and copied the directories to the other machine (i.e. the machine not connected to the internet). This appears to have worked but it is not clear why the other method did not (local CRAN copy with updated PACKAGES file). The one thing I noticed is, when hitting the usual CRAN repository, it used .zip versions of the libraries and not the tar.gz; I am not sure if that matters.
EDIT 3
Based on the response from David Gohel in the this ReporteRs Issues, the following code with the INSTALL_opts = "--no-multiarch" added may fix the issue:
install.packages("ReporteRs", contriburl=cran_dir_url,
repos = cran_dir_url,
type = 'source', INSTALL_opts = "--no-multiarch")
I will add this as an answer if I determine that it would fix the issue, however, I have already implemented the workaround mentioned in EDIT 2.
Based on the response from David Gohel in this GitHub ReporteRs Issues, the following code with the INSTALL_opts = "--no-multiarch" added, fixed the issue I was having:
install.packages("ReporteRs", contriburl=cran_dir_url,
repos = cran_dir_url,
type = 'source',
INSTALL_opts = "--no-multiarch")
Edit
The variable cran_dir_url should point to a directory that contains the .tar.gz install package files. Two examples of paths that could be used are the following:
# (*) Web: URL pointing to CRAN
cran_dir_url <- "https://cloud.r-project.org/src/contrib"
# (*) Local: Pointing to local copy of CRAN (or whatever local packages you
# would like to install).
# Note: this example is a Mac OS path with username "someuser".
# Note: the three "/" chars are correct ("file://" followed by "/Users/..." => "file:///Users/..."
cran_dir_url <- "file:///Users/someuser/CRAN_Local/"
Inside of the above two paths (http and file), there will be .tar.gz files (e.g. ggplot2_3.3.5.tar.gz).
I am trying to install 'indexing' package in r: R-Forge
However, It says it is "failed to build" & am looking for a way to fix this? I do not see a download option for the package.... I am currently on MAC OSX Yosemite and trying to load this in the latest R-Studio.
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
When trying to load via r-studio:
install.packages("indexing", repos="http://R-Forge.R-project.org")
> source repository is unavailable to check versions
> Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed!
Even though the download link on R-forge doesn't appear to work any more (it may say not available for version >= 3.3. etc), you can still install indexing from source on OSX (or any other operating system).
Open a new terminal in OS X, and in a directly of your choice type the following to install indexing:
svn checkout svn://svn.r-forge.r-project.org/svnroot/indexing/
If you did this correctly, type ls in the terminal and you should see a new directory called indexing. Inside this directory is the source code you need to build the indexing package.
Without changing from the current directory, install the dependency R package mmap if you don't already have it (you might have already installed in from CRAN, in which case you may be able to skip this step) with:
R CMD INSTALL indexing/pkg/mmap
Finally, install indexing from source
R CMD INSTALL indexing/pkg/indexing
You should see something like this in the terminal output if successful:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
* installing *source* package ‘indexing’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.3/Resources/library/indexing/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (indexing)
Enjoy!
This question already has answers here:
NOTE in R CRAN Check: No repository set, so cyclic dependency check skipped
(2 answers)
Closed 8 years ago.
I have read NOTE in R CRAN Check: No repository set, so cyclic dependency check skipped and to the best of my knowledge followed the suggestions. Specifically I have an .Rprofile file in ~/ with the line options(repos = c(CRAN=\"http://cran.r-project.org\"). I ran the bash script at the bottom of the page and still have two notes instead of the one I would expect about a New submission.
bash-3.2$ ${R} CMD check --as-cran ${name}
* using log directory ‘/private/tmp/deptest.Rcheck’
* using R version 3.1.2 (2014-10-31)
* using platform: x86_64-apple-darwin13.4.0 (64-bit)
* using session charset: UTF-8
* checking for file ‘deptest/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘deptest’ version ‘1.0’
* checking CRAN incoming feasibility ... NOTE
Maintainer: ‘John Doe <jdoe#doe.net>’
New submission
* checking package namespace information ... OK
* checking package dependencies ... NOTE
No repository set, so cyclic dependency check skipped
* checking if this is a source package ... OK
Any suggestions how to eliminate the second note about No repository set, so cyclic dependency check skipped when running R CMD check --as-cran would be most welcome. I get the same two notes when trying to create a much larger package as well. The same two notes appear when I try to build a package using RStudio as the editor for what that is worth.
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.1.2
To verify the contents of .Rprofile I entered:
ip-152010130116:~ alan$ pwd
/Users/alan
ip-152010130116:~ alan$ open -a TextEdit .Rprofile
and the single line in .Rprofile is
options(repos = c(CRAN = "http://cran.r-project.org"))
Thanks in advance
What is the likelihood CRAN will accept a package with the NOTE
No repository set, so cyclic dependency check skipped?
I had your problem too, and fixed it by adding the following to .Rprofile:
local({r <- getOption("repos"); r["CRAN"] <- "http://ftp.ussg.iu.edu/CRAN/"; options(repos = r)})
I think your issue is because you're not pointing to a specific CRAN mirror.
You will want to change the repository to reflect the mirror nearest you.
I am writing a new extension for R. I have loaded all my functions into the Global Environment and ran
package.skeleton('package_name')
in the NAMESPACE file I have added all the required packages:
import(PerformanceAnalytics)
import(fBasics)
import(splines)
import(quantmod)
and added a LazyData:yes option to the DESCRIPTION file.
When I R CMD INSTALL package_name it goes without errors, only with several warnings:
When I run the package check I get
* using log directory 'folder path here'
* using R version 2.15.0 (2012-03-30)
* using platform: i386-pc-mingw32 (32-bit)
* using session charset: ISO8859-1
* checking for file 'package_name/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'package_name' version '1.0'
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Namespace dependencies not required:
'PerformanceAnalytics' 'fBasics' 'quantmod'
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
In the R session typing library(package_name) all is being loaded without errors (few warnings with the naming conventions) but I cannot see any of the functions. What could possible cause that? When I do all the above with the tutorial example everything works fine. No S3 or S4 is being used - just plain R functions
Thanks,
Vladimir