[R] deSolve, unresolved namespace error

Thomas Petzoldt thpe at simecol.de
Wed Nov 6 22:56:59 CET 2013


On 11/6/2013 6:50 PM, Adam Clark wrote:> Addendum:
> unloading and reloading deSolve.so does indeed fix the problem:
>
> library.dynam.unload("deSolve", libpath=paste(.libPaths()[1],
> "//deSolve", sep=""))
> library.dynam("deSolve", package="deSolve", lib.loc=.libPaths()[1])
>
> However, this is a little clunky, and seems like overkill. Does
> anybody have an idea for a more elegant workaround?


Adam,

the solver lock is used for the ODEPACK solvers to prevent simultaneous
(i.e. nested) calls of the solver within R session, because the ODEPACK
algorithms use some global variables. The RK solvers do not use
global variables, so they have no lock.

If you use the ode solvers in the intended way, an internal call of:

  on.exit(.C("unlock_solver"))

should always unlock the solver, even if the function is exited due to
an error. However, your example may point to another problem in the
code, for which we need a minimal reproducible example.


As a first workaround, you may try to call:

.C("unlock_solver")

... but calling an internal .C package function outside a package is
generally not recommended, so you should definitely try to find the real
cause of your problem.

Thomas



PS: please move this thread to either R-Devel or (preferred) to the
specialised mailing list:

mailto:R-sig-dynamic-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models



More information about the R-help mailing list