hrue / r-inla

This is the public repository for the r-inla project
GNU General Public License v2.0
82 stars 24 forks source link

Increase minimum version of Matrix to >= 1.6-2 #86

Closed matteodelucchi closed 6 months ago

matteodelucchi commented 9 months ago

I recently encountered test failures in abn, which is relying on INLA. These tests were functioning correctly a couple of weeks ago, indicating that the issue is relatively recent.

Apparently, other users seem to experience similar problems with INLA. The root cause appears to be a change in the ABI within the Matrix package, a dependency of INLA. This has been discussed in a SO answer, suggesting the solution to upgrade Matrix and MatrixModels.

Therefore, I suggest an update to the INLA package dependencies. Specifically, to increase the minimum version of the Matrix package to >= 1.6-2: https://github.com/hrue/r-inla/blob/59675efd51a3cac8692b5b83e390da4ae7917381/rinla/DESCRIPTION#L19

I look forward to hearing your thoughts on this proposed solution.

finnlindgren commented 9 months ago

No, as far as I've found, INLA doesn't need a more restrictive Matrix dependency. The issue is discussed further here: https://github.com/inlabru-org/inlabru/issues/218 The problem only occurs due to some specific binary packages being out of sync. Once the binary builds of those packages on CRAN catch up with each other the problem should go away. INLA itself doesn't need rebuilding. Imposing a stricter Matrix dependency would needlessly prevent INLA installations on systems that don't have (or need) the newer Matrix version.

finnlindgren commented 9 months ago

Further, those other packages also don't need to depend on the latest Matrix version; it's a binary package issue, and they still work fine with the older version, and wouldn't be automatically fixed by changing the Matrix version dependency.

finnlindgren commented 9 months ago

The problem is that CRAN doesn't automatically rebuild the binary packages when there are dependency ABI changes; I saw a discussion about that on r-pkg-devel about this precise issue a while back.

finnlindgren commented 9 months ago

To be more clear, as far as I know, the issue is with the binary packages for MatrixModels and potentially some other packages, but not the binary INLA packages.

finnlindgren commented 9 months ago

Here's the core bug report for MatrixModels itself: https://bugs.launchpad.net/ubuntu/+source/rmatrix/+bug/2043461 In short, all MatrixModels binary packages need rebuilding. We can't fix CRAN ourselves, and updating the INLA Matrix version dependency would not solve problem either (in fact, it would make it worse). The temporary fix on user systems is

install.packages("MatrixModels", type = "source")
finnlindgren commented 9 months ago

In some cases, package checking with github actions are also affected by this. I've just added this to the checking workflows for inlabru, e.g. https://github.com/inlabru-org/inlabru/blob/devel/.github/workflows/R-CMD-check.yaml

      - name: Fix temporary out-of-sync binary packages
        run: |
          install.packages("MatrixModels", type = "source")
        shell: Rscript {0}

but this didn't actually fix the problem I had seen on ubuntu-latest (oldrel-1), as it appears to have ignored the type="source" argument. I don't see any problems for current R (but it just appeared for R-devel).

I think the MatrixModels maintaners (which appear to be the same as the Matrix maintainers) may need to bump the MatrixModels version and submit as a new version to CRAN, to force a rebuild.

finnlindgren commented 9 months ago

This tweak solved the github actions issue, and will likely also be helpful on some user systems; the default repository in the github action was the posit servers, that apparently lead it to install the out-of-sync binary package instead of the asked for source package.

- name: Fix temporary out-of-sync binary packages
        run: |
          install.packages("MatrixModels", repos = "https://cloud.r-project.org", type = "source")
        shell: Rscript {0}