Troubles with shiny markdown and Rmpfr (0.5-7) package - r

I am using RStudio on a windows machine. recently, I wanted to deploy an shiny-markdown document using the HH library - wihout sucess. I broke down the error to the following test program
---
title: "Untitled"
runtime: shiny
output: html_document
---
```{r}
require( Rmpfr )
```
This program works well if I run it locally. However, if I try to deploy it to shinyapps.io using shinyapps::deployApp(), RStudio tries to build the package Rmpfr from source even tough the package is already installed. This building from source fails with the following error (full error log: http://pastebin.com/D5KVc44n)
configure: error: Header file mpfr.h not found; maybe use --with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
* removing ‘/usr/local/lib/R/site-library/Rmpfr’
################################# End Task Log #################################
Error: Unhandled Exception: Child Task 61322212 failed: Error building image: Error building Rmpfr (0.5-7). Build exited with non-zero status: 1
I think this question is related to this one about the rmpfr package, but the solution does not work on windows since it uses the apt-get command.
Any suggestions are welcome.
EDIT: I already tried to make mpfr.h available. I downloaded the mpfr package from http://www.mpfr.org/mpfr-current/, unpacked it and added it to the windows PATH variable. I also copied the entries of the mpfr-3.0.0 folder to the R working directory. Both methods showed no success.

Related

Cannot install vignette from an R package on GitHub

I coded an R package that is hosted on my GitHub. I included a vignette, and I can install the package and load the vignette without any issue from R and RStudio by doing:
devtools::install_github("rosalieb/serac", build_vignettes = TRUE)
library(serac)
vignette("serac")
However, I have a few colleagues who cannot install the vignette (the only way they can download the package is by doing devtools::install_github("rosalieb/serac") (default of build_vignettes is FALSE).
It works if they use RStudio, but not in 'regular' R.
I encourage people to use RStudio, but I cannot force them, and eventually, I do not understand why it would work in 'regular' R for me but not for them.
They tried to install pandoc, knitr, Rtools - none of these worked.
Here is the error message when my colleague tries to install the package with the vignette:
v checking for file 'C:\Temp\RtmpO8YwVb\remotesf9842f1431\rosalieb-serac-46a3587/DESCRIPTION'
- preparing 'serac':
checking DESCRIPTION meta-information ...
checking DESCRIPTION meta-information ...
v checking DESCRIPTION meta-information
- installing the package to build vignettes
creating vignettes ...
creating vignettes ...
E creating vignettes (4.9s)
--- re-building 'serac.Rmd' using rmarkdown
Error: processing vignette 'serac.Rmd' failed with diagnostics:
Pandoc is required to build R Markdown vignettes but not available. Please make sure it is installed.
--- failed re-building 'serac.Rmd'
RESUME : le traitement du fichier suivant a échoué :
'serac.Rmd'
Erreur : Vignette re-building failed.
Exécution arrêtée
Erreur : Failed to install 'serac' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed
Thanks in advance for your help!
The message indicates that rmarkdown::render can't find Pandoc.
It looks for it in three places: in the directory specified by the RSTUDIO_PANDOC environment variable, in directories on the PATH, in the directory opt/pandoc in the user's home directory. So your colleagues who have installed it should make sure it is available in one of those locations. They can see the current values of the environment variables by running
Sys.getenv("PATH")
and
Sys.getenv("RSTUDIO_PANDOC")
Temporary changes can be made using
Sys.setenv(RSTUDIO_PANDOC="/path/to/pandoc/directory")
This needs to happen in the session that is trying to install the package and build the vignette, not in the vignette itself.
How to make permanent changes to those values depends on the details of what system they are running.

ERROR conda.core.link:_execute(700): An error occurred while installing package 'conda-forge::jupyter_nbextensions_configurator-0.4.1-py37_0'

I'm trying to install jupyter_nbextensions_configurator on windows10 for python3.7 using conda.
An error occurred while installing the package.
I have already tried to reinstall anaconda,but the problem still occurs.
ERROR conda.core.link:_execute(700): An error occurred while installing package 'conda-forge::jupyter_nbextensions_configurator-0.4.1-py37_0'.
Rolling back transaction: done
LinkError: post-link script failed for package conda-forge::jupyter_nbextensions_configurator-0.4.1-py37_0
location of failed script: C:\Users\Cesare\Anaconda3\Scripts\.jupyter_nbextensions_configurator-post-link.bat
I want to know how to install it successfully.
I too was facing the same problem. Here's the output when I tried cloning the base environment [Running as Administrator]:
(base) PS C:\WINDOWS\system32> conda create --name django --clone base
WARNING: A conda environment already exists at 'C:\Users\Tanishk\anaconda3\envs\django'
Remove existing environment (y/[n])? y
Source: C:\Users\Tanishk\anaconda3
Destination: C:\Users\Tanishk\anaconda3\envs\django
The following packages cannot be cloned out of the root environment:
- conda-forge/win-64::conda-4.9.2-py38haa244fe_0
- defaults/win-64::conda-build-3.20.5-py38_1
- defaults/win-64::conda-env-2.6.0-1
Packages: 305
Files: 2077
Preparing transaction: done
Executing transaction: done
ERROR conda.core.link:_execute(698): An error occurred while installing package 'defaults::openssl-1.1.1h-he774522_0'.
Rolling back transaction: done
CondaError: Cannot link a source that does not exist. C:\Users\Tanishk\anaconda3\pkgs\openssl-1.1.1h-he774522_0\Library\bin\openssl.exe
Running `conda clean --packages` may resolve your problem.
()
You will notice the package giving me problem is different than yours, but the ERROR remains the same (ERROR conda.core.link).
Here's how I solved it:
Google the package mentioned in the ERROR. In my case it was openssl-1.1.1h-he774522_0
Open the result from Anaconda Files (should likely be the first search result):
anaconda / packages / openssl 1 - Files :: Anaconda Cloud
Ctrl+F to find the package in the list.
Download the compressed package to your local Downloads folder.
Backup the contents of the installed erroneous package *C:\Users\Tanishk\anaconda3\pkgs\openssl-1.1.1h-he774522_0* somewhere.
Copy the contents of the de-compressed downloaded package into the *C:\Users\Tanishk\anaconda3\pkgs\openssl-1.1.1h-he774522_0* folder.
Re-try in Anaconda prompt with whatever you got stuck at.
Note:
After step 7, I got another same error but for a different package this time (vs2015_runtime-14.16.27012-hf0eaf9b_3). I performed the same steps for this package too --> Google -- Download -- Replace old content. And I was able to run things successfully after that.
I suggest to google the package because if you search for the package name on Anaconda itself, it will ask you to login first.

ENOENT while using R pkgdown

Cloning the v 1.1.0 of pkgdown and trying to run pkgdown::build_site() gives me the following error:
> pkgdown::build_site()
══ Building pkgdown site ═══════════════════════════════════════════════════════
Reading from: '/home/farm/Documents/pkgdown-1.1.0'
Writing to: '/home/farm/Documents/pkgdown-1.1.0/docs'
── Initialising site ───────────────────────────────────────────────────────────
Writing 'sitemap.xml'
── Building home ───────────────────────────────────────────────────────────────
<ENOENT: [ENOENT] Failed to remove '/tmp/Rtmp0utBMA/file114d619b1b68.html': no such file or directory>
Error: [ENOENT] Failed to remove '/tmp/Rtmp0utBMA/file114d619b1b68.html': no such file or directory
Execution halted
Most likely is a problem with my Linux and R, not the package itself. That being said, this is the environment:
R: 3.5.1
Manjaro: 18.0.0-rc
How can I fix this? I'm trying to avoid using chmod -R 777 /tmp/
note: I also ran devtools::test() and devtools::check(), no errors or warnings.
After trying to build a package from scratch, I found my mistake... Pandoc was missing, installing it from AUR fixed it.

Pandoc not recognized as R library

I installed Pandoc manually through this installation - link.
After restarting the system, I was able to locate the installation folder at C:/Users/YourUserName/AppData/Local/Pandoc
But when I'm trying to call the library:
library("pandoc", lib.loc = "C:/Users/YourUserName/AppData/Local/Pandoc")
I'm getting the following error:
Error in library("pandoc", lib.loc = "C:/Users/YourUserName/AppData/Local/Pandoc") :
no library trees found in 'lib.loc'
As i'm behind a firewall, I cannot install pandoc through github. So the install.pandoc() function is out.
Any ideas where I'm getting the installation process wrong?
Edit:
I've changed .LibPath to point to Pandoc's installation folder:
.libPaths('C:/Users/stefanj/AppData/Local/Pandoc')
And if I check, it seems to be ok:
> grep("pandoc", list.files(.libPaths()))
[1] 22 24
library(pandoc)
Error in library(pandoc) : there is no package called ‘pandoc’
Execution halted
I agree to #Dason's point that library in path : "C:/Users/YourUserName/AppData/Local/Pandoc" is not any library/package connected with R. It's just pandoc installed.
Other way to install pandoc would be using installr :
installr::install.pandoc()
Now, for performing for converting from one markup format to another, use the following package :
rmarkdown
The rmarkdown package includes high level functions for converting to a variety of formats. For
example:
render("input.Rmd", html_document())
render("input.Rmd", pdf_document())
Hope this helps.

Error deploying shinyapp fatal error: plogr.h: No such file or directory

I'm trying to deploy a Shiny app. When the app is running in RStudio I select the deploy button to republish my updated app.
After a minute or so I receive the following error block in the console:
/usr/local/lib/R/site-library/dplyr/include/dplyr/main.h:11:19: fatal error: plogr.h: No such file or directory
#include <plogr.h>
^
compilation terminated.
In file included from /usr/local/lib/R/site-library/dplyr/include/dplyr.h:4:0,
from rows-data.cpp:2:
/usr/local/lib/R/site-library/dplyr/include/dplyr/main.h:11:19: fatal error: plogr.h: No such file or directory
#include <plogr.h>
^
compilation terminated.
make: *** [rows.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [rows-data.o] Error 1
ERROR: compilation failed for package ‘purrr’
* removing ‘/usr/local/lib/R/site-library/purrr’
################################# End Task Log #################################
Error: Unhandled Exception: Child Task 492377328 failed: Error building image: Error building purrr (0.2.2). Build exited with non-zero status: 1
Execution halted
I found this discussion on Google groups. Reading through this discussion I tried to reinstall dplyr with dependencies = T.
Here are the libraries I try to load with my app:
library(tidyverse)
library(shiny)
library(shinydashboard)
library(shinyjs)
library(lubridate)
library(DT)
library(scales)
I also tried to install plogr directly:
> install.packages("plogr.h")
Warning in install.packages :
package ‘plogr.h’ is not available (for R version 3.3.3)
Does anyone have any advice for deploying my Shinyapp based on this info? What should I do to get around this error?
#Doug Fir I also struggled with this but finally got this working.
1) I first also tried with no luck to
install.packages("dplyr", dependencies = TRUE)
2) So I then took a good look at the error messages on Deploy tab in Rstudio and noticed that it was complaining about another package or two. In this case purrr and Rcpp. So I reinstalled these two as well.
so I:
install.packages(c("Rcpp","purrr"))
3) I noticed Shiny was not up to date (1.0.1 not 1.0.5) so I updated that for good measure.
install.packages("shiny")
4) then quit Rstudio and restarted R.
Shiny app with dplyr then finally redeployed. Not sure if this beats your answer, but at least dplyr 0.7.4 worked without needing to downgrade.
I am posting this to provide clues if someone else has this problem.
I downloaded an earlier version of DPLYR (0.5.0 no reason, just randomly chose that version) from here. Doing this seemed to fix everything, I don't know why.

Resources