I have a R package that I am trying to setup pkgdown for. I'm following the instructions here, and am running build_site() to generate the docs directory. When running this command, I get the error
Quitting from lines 28-29 (Data-Model.Rmd)
Error : package or namespace load failed for 'dm':
.onLoad failed in loadNamespace() for 'dm', details:
call: register_pkgdown_methods()
error: rlang::is_installed(c("DiagrammeR", "DiagrammeRsvg")) is not TRUE
Showing that the build is failing when trying to render one of the vignettes. However, if I just try to knit this vignette in a fresh interactive session, it knits fine.
I have tried including DiagrammeR and DiagrammeRsvg in Depends, Imports, or Suggests, and it still fails with the same error.
Any idea what I can do to fix this? The vignette is located on my github here. I understand this is not the ideal way to share an example, but it can repro'd by cloning the repo and running pkgdown::build_site()
The error is fairly informative; it tells you that
rlang::is_installed(c("DiagrammeR", "DiagrammeRsvg"))
is not TRUE. I suspect if you run that line it will in fact return FALSE. I installed DiagrammeRsvg and the vignette built successfully.
I am not entirely sure why building the vignette with pkgdown requires SVG export of your diagrams, but knitting them doesn't. Hopefully that solves the issue, though.
Related
I am trying to load a package in RStudio from GitHub but I get an error.
I have also updated all the packages in order to see if this was the problem but I still get the same error. I have a MAC pc (I don't know if this may cause some problems).
The link of the package that I would like to load is:
https://github.com/andrewraim/COMMultReg
and there is written that in order to load it I need to run
library(devtools)
install_github("andrewraim/COMMultReg")
But when I run the second line I get as error:
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘COMMultReg’ in namespaceExport(ns, exports):
undefined exports: d_cmb, d_cmb_sample, d_cmm, d_cmm_sample, gunterize, loglik_score_fim_cmm, normconst_cmb, normconst_cmm, r_cmb
Errore: loading failed
Esecuzione interrotta
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/COMMultReg’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/n0/4lmr1lrj7qqfylmh6s8qx0nr0000gn/T//RtmpldrmHr/file72e1e4469d/COMMultReg_0.1.0.tar.gz’ had non-zero exit status
Can somebody help me telling me what to do?
Thanks!!
The package has no function named d_cmb, but it tries to export that function. That's what the error message says, and it's true.
I think the reason for this error is that the author used Roxygen2 to generate his NAMESPACE file where the exports are declared, but that file is out of sync with the contents of the package.
It's possible this happened because the author forgot to commit a new file containing the new code. In that case, the best solution is to contact the author, and point out the issue.
Alternatively, it may have happened because at one time there was a d_cmb function, but the author removed it, without updating the NAMESPACE file. This one you might be able to fix yourself.
To fix this, you'll need to run Roxygen2 yourself, which is a little more complicated than just installing what's on Github. Here are the steps:
Fork the package to your own Github account if you have one. (This step is optional, but it makes some later steps easier.)
Download the source for the package. In RStudio, the quickest way to do this is to create a new project using Version Control, Git, and give the URL
of your forked copy, or the original URL if you skipped that.
Run Roxygen2 on the package. In RStudio, you do this by choosing "Document" in the "More" menu of the Build tab.
Try to build it. If you're lucky, it will now build properly. If not, fix the next problem.
This is very important: send your changes back to the original author. If you forked the package, this is easy; if not, figure out a way to do it.
this is the maintainer of the COMMultReg package. I didn't know about this thread until now, but it sounds like you were able to get started from the answer by user2554330.
The functions d_cmb, d_cmb_sample, etc are supposed to be exported. I think the problem may have been that, at the time of the question, I did not have src/RcppExports.cpp and R/RcppExports.R checked into Github. This seems to be necessary to use install_github on a package with exported Rcpp functions. Those were checked in around 8 months ago. (Coincidentally not long after this question was posted?)
Please let me know if you still having trouble with the install. Otherwise, enjoy the package!
I am trying to compile a pdfbook using R-markdown. After I knit I get the following error:
! LaTeX Error: File `pdfpages.sty' not found.
I loaded tiny text using library(tinytex) to help me install the package pdfpages but continue to have the same error. I resorted to running Rstudio in administrator mode and try the preceding step and running the following tinytex::parse_install(text="! LaTeX Error: File `pdfpages.sty' not found.") (as suggested in Yihui in bookdown). Both resulted in the same error.
Any other suggestion on what is wrong? The package is clearly installed, so I do not know what else can the error be.
Generally when you get an error like pdfpages.sty not found, you need to install the package. From the command line (assuming the Tex bin is in your path) use "tlmgr install pdfpages". Yihui Xie called it "TinyTex" because it was a minimal install compared to something like MacTeX or TexLive.
I created my own package with the RStudio build tools and building/loading the package via the build tools works fine. My functions run as desired and the documentation works fine as well.
Writing the package as a source file works fine, too, as well as installing the package from source. Though, when I execute functions after installing the package from source I get an "R code execution error" as well as the error message
Error in fetch(key) : cannot allocate memory block of size 2.7 Gb
The size of the memory block in the error message varies every time.
So the problem is that I can't run any functions after installing the package from source. I need to be able to share the package as a source file though.
Does anyone have experience with this kind of problem? Is it related to writing the package as a source file? I could not find anything so far.
Additional info: When I run the "check package" command, everything works fine except for one error checking the given examples. The examples should not be an issue though, right?
I've been building an HTML document with RMarkdown, and everything was going ok, until I installed Microsoft R open (3.3.2) and now everytime I try "Knitr HTML" it returns the following:
Error : .onLoad failed in loadNamespace() for 'RevoUtilsMath', details:
call: NULL
error: To use RevoUtilsMath you must first install the MKL Math Library.
Visit http://mran.revolutionanalytics.com/download.
If you have previously installed the MKL Math Library,
remove it using Add/Remove Programs, then re-install.
Error: package or namespace load failed for 'RevoUtilsMath'
Execution halted
I also re-installed the MRO, just to understand if something went wrong during the installation, and it still returns that error.
I was wondering if someone had the same difficulty and would like to share how to fix this. I have no idea on how installing MRO has such an influence in R markdown.
It looks to me like this isn't necessarily an issue with RMarkdown, but a compatibility issue with RevoUtilsMath and the MKL libraries. It's referenced on the github for RRO (which Microsoft acquired and is now MRO) here:
https://github.com/RevolutionAnalytics/RRO/issues/152
I haven't experienced the error myself, but there is a google group which references and solves that issue here:
https://groups.google.com/forum/#!topic/rropen/jKfR40DcIbE
The third response down is the users solution, and just below that is a microsoft support rep explaining how to properly setup MKL and RevoMathUtils. Hope that helps!
I am trying to use this source from github.
devtools::source_url('https://raw.githubusercontent.com/brooksandrew/Rsenal/master/R/bin.R')
I could use this and work with it till few hours back. but now it gives me the following error
Error in loadNamespace(name) : there is no package called ‘Rsenal’
The code is still there in the provided url. I did re run the following two commands but still not working.
install.packages("devtools")
library("devtools")
What should I do to fix this issue?
I believe your issue is arising because you are sourcing functions that live inside a package, that is meant to be distributed as a package.
Instead of using devtools::source_url(), try this:
devtools::install_github('brooksandrew/Rsenal')
library("Rsenal")
Once the package is properly installed, all of the primary functions (such as binCat()) should be available for use.
I believe you ran into this error because some functions within the package probably depend on others that are not found within the two files you manually sourced. So when those lines are executed, R looks for the Rsenal package file and does not find them.
Further troubleshooting would require a reproducible example.