Problem installing lpgr

I am trying to install lpgr using option B in https://jtimonen.github.io/lgpr-usage/index.html. For this I had to install ggpubr. During the installation I have received bunch of warnings and at least one error:

/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/eigen_plugins.h:183:5: error: ‘vari_return_t’ does not name a type; did you mean ‘error_return’?
vari_return_t operator()(T &v) const { return v.vi_; }
^~~~~~~~~~~~~
error_return

  • Operating System

Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

  • RStan Version

rstan_2.19.2

  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++

  • Output of devtools::session_info("rstan")
    Wasn’t able to install devtools for the same error

Hi linas,

Is it the ggpubr or the lgpr package that is failing to install? In other words, do you get this same error from install.packages("ggpubr")?

I think you are going to need to do

remove.packages(c("StanHeaders", "rstan"))
file.remove(".RData")
# restart R
install.packages(c("StanHeaders", "rstan"))

Thanks to all. R has a bunch of library paths. I saw that rstan is installed in two places. One is /usr/lib/R/site-library, another is /home/user/R/x86_64-pc-linux-gnu-library/3.6. Is it OK?

I did

sudo apt-get remove r-cran-rstan 

and then

sudo add-apt-repository -y "ppa:marutter/rrutter3.5"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"
sudo apt update
sudo apt install r-cran-rstan

Now I was able to install devtools and lpgr.

I would guess that two instances of rstan may create conflicts in the future. How to clean it up?

What you did is fine. You can even have two different rstans. They just need to have the right StanHeaders with them. The problem shouldn’t persist past this week.

Funny part is that lpgr wasn’t installed although when I did
devtools::install_github('jtimonen/lgpr')
R told Done(lpgr)
How to install lpgr?

The /home folder contains both rstan and Stanheaders. Other folder contains only rstan. Is this OK?

I think lgpr is installed now and probably works with any version of rstan that compiles correctly.

Well,
library(lpgr)
Error in library(lpgr) : there is no package called ‘lpgr’

My fault - it is lgpr NOT lpgr. Sorry…