epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

Change minimum required version of rstan #179

Open davidsantiagoquevedo opened 6 months ago

davidsantiagoquevedo commented 6 months ago

Please place an "x" in all the boxes that apply


I got the following error when installing serofoi v 0.1.0. I have rstan 2.21.8 and rstantools 2.3.1.1. Updating both dependencies to their last versions fixes it. However, the versions in the DESCRIPTION file are > 2.18.1 and > 2.3.1, respectively.

ℹ Building serofoi 0.1.0                                           
✖ Failed to build serofoi 0.1.0                                    
Error:                                                             
! error in pak subprocess
Caused by error in `stop_task_build(state, worker)`:
! Failed to build source package 'serofoi'
Full installation output:
* installing *source* package 'serofoi' ...
staged installation is only possible with locking
** using non-staged installation
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
No matches for: 

  prob_infected_calculate(vector, matrix, int, int, int[ ])

Function prob_infected_calculate not found.
 error in 'model_tv_normal' at line 39, column 3
  -------------------------------------------------
    37:     age_max,
    38:     chunks
    39:   );
          ^
    40: }
  -------------------------------------------------

Error in rstan::stanc(file_name, allow_undefined = TRUE, obfuscate_model_name = FALSE,  : 
  failed to parse Stan model 'tv_normal' due to the above error.
Calls: <Anonymous> -> sapply -> lapply -> FUN -> <Anonymous>
Ejecución interrumpida
ERROR: configuration failed for package 'serofoi'
* removing '/tmp/RtmpQrI27O/pkg-lib2692291c945a/serofoi'
Type .Last.error to see the more details

ntorresd commented 6 months ago

It seems like it's a problem with the inclusion of prob_infected.stan in the functions{} chunks of the stan models. This is also done in {EpiNow2}, where the minimum required versions of these packages are rstan v2.26.0 and rstantools v2.2.0.

@jpavlich is there any way we can check what the minimum versions actually are for serofoi?

jpavlich commented 6 months ago

I'm not aware of any direct way to find that out. I see two possible alternatives:

  1. Carefully review stan's documentation to find the minimum version that supports every stan function used by serofoi
  2. Brute-force test until we find the minimum version for which serofoi builds without issues

It seems 2 is the easiest one :)

jpavlich commented 6 months ago

@davidsantiagoquevedo Which version of StanHeaders are you using?

davidsantiagoquevedo commented 6 months ago

After updating rstan and rstantools I have 2.32.7. But I didn't take the version I had when the error occurred.

davidsantiagoquevedo commented 6 months ago

I tested the installation on another machine, and it worked with

 > packageVersion("rstan")
[1] ‘2.26.22’
> packageVersion("rstantools")
[1] ‘2.3.1.1’
> packageVersion("StanHeaders")
[1] ‘2.26.27’

This might be a good starting point for the brute-force approach.

jpavlich commented 6 months ago

I would postpone this issue until we create the new, refactored, serofoi version.

ntorresd commented 2 weeks ago

I think we should address this now for the current development version of the pacjage @jpavlich