glmmTMB / glmmTMB

glmmTMB
299 stars 61 forks source link

Heads-up: Warning about TMB version inconsistency (1.9.1 vs. 1.9.2) #886

Open MToddASU opened 1 year ago

MToddASU commented 1 year ago

Apparently, TMB was updated recently (as in 2 days ago) from 1.9.1 to 1.9.2. I have the newest version on my machine, and when I load glmmTMB (1.1.5), I get the following warning and instruction:

library(glmmTMB) Warning message: In checkDepPackageVersion(dep_pkg = "TMB") : Package version inconsistency detected. glmmTMB was built with TMB version 1.9.1 Current TMB version is 1.9.2 Please re-install glmmTMB from source or restore original ‘TMB’ package (see '?reinstalling' for more information)

I'll try reverting back to TMB 1.9.1 for now, but I just wanted to let you know about the change.

Thanks!

mebrooks commented 1 year ago

Rather than reverting TMB, you should probably try re-installing glmmTMB from source as the helpfile (?reinstalling) says to (e.g. install.packages("glmmTMB", type="source"). Does that remove the warning?

MToddASU commented 1 year ago

That did make the warning go away, and I was able to successfully estimate a model I set up before updating either package.

During the re-install of glmmTMB, several warnings seeming to have to do with TMB and Rcppeigen came up (first of 17 warnings is pasted below). Not sure how consequential the "problems" are generally speaking, but they didn't seem to keep things from running for me.

Thanks again.


install.packages("glmmTMB", type="source") trying URL 'https://cran.rstudio.com/src/contrib/glmmTMB_1.1.5.tar.gz' Content type 'application/x-gzip' length 3985160 bytes (3.8 MB)

downloaded 3.8 MB

bbolker commented 1 year ago

I think these are chaff. Some of them may go away if you adjust your system-level/user-level Makevars file as suggested at https://github.com/kaskr/adcomp/issues/277 (I can't test right now).

bbolker commented 1 year ago

Related to https://github.com/glmmTMB/glmmTMB/issues/794 - raises the question of (1) whether we should make a point of version-bumping glmmTMB every time there's a new TMB release or (2) try to figure out where to start/continue the conversation about the possibility of CRAN re-building binary packages : maybe Dirk Eddelbuettel, or someone involved in the group that's discussing R infrastructure etc. (I think Miles McBain, @mmaechler are involved?)

MToddASU commented 1 year ago

My testing was inconclusive. I had been meaning to move from R 4.1.3 to the current release anyway. As part of that process, I ran into other problems, so I decided to just wipe all the packages and start over. I ran the "standard" install of glmmTMB, which of course, pulled in the latest version of TMB. I still get the version inconsistency warning, but again, everything seems to work as it did before in glmmTMB. I might try to go through the recommended steps again when I have a free moment.

Thanks again!

clairerichardsRN commented 1 year ago

I'm having a related issue perhaps. I have R 4.2.2 and just installed glmmTMB but it is giving me an error about the TMB package. I tried to uninstall and reinstall TMB but it's giving me a heartache.

library(glmmTMB) Warning message: In checkMatrixPackageVersion() : Package version inconsistency detected. TMB was built with Matrix version 1.5.3 Current Matrix version is 1.5.1 Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package

Then when I try to install TMB

install.packages('TMB', type = 'source') Installing package into ‘C:/Users/claire.richards/Documents/R/win-library/4.2’ (as ‘lib’ is unspecified) trying URL 'https://ftp.osuosl.org/pub/cran/src/contrib/TMB_1.9.2.tar.gz' Content type 'application/x-gzip' length 756463 bytes (738 KB) downloaded 738 KB

The downloaded source packages are in ‘C:\Users\claire.richards\AppData\Local\Temp\RtmpYdmTXG\downloaded_packages’ Warning message: In install.packages("TMB", type = "source") : installation of package ‘TMB’ had non-zero exit status

remove.packages("TMB") Removing package from ‘C:/Users/claire.richards/Documents/R/win-library/4.2’ (as ‘lib’ is unspecified) library(TMB) Error in library(TMB) : there is no package called ‘TMB’ install.packages("TMB") Installing package into ‘C:/Users/claire.richards/Documents/R/win-library/4.2’ (as ‘lib’ is unspecified) trying URL 'https://ftp.osuosl.org/pub/cran/bin/windows/contrib/4.2/TMB_1.9.2.zip' Content type 'application/zip' length 1891304 bytes (1.8 MB) downloaded 1.8 MB

package ‘TMB’ successfully unpacked and MD5 sums checked Warning: cannot remove prior installation of package ‘TMB’ Warning: restored ‘TMB’

The downloaded binary packages are in C:\Users\claire.richards\AppData\Local\Temp\RtmpYdmTXG\downloaded_packages Warning message: In file.copy(savedcopy, lib, recursive = TRUE) : problem copying C:\Users\claire.richards\Documents\R\win-library\4.2\00LOCK\TMB\libs\x64\TMB.dll to C:\Users\claire.richards\Documents\R\win-library\4.2\TMB\libs\x64\TMB.dll: Permission denied

Sooo... I restarted R and tried to reinstall TMB and got this error: Installing package into ‘C:/Users/claire.richards/Documents/R/win-library/4.2’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- trying URL 'https://ftp.osuosl.org/pub/cran/src/contrib/TMB_1.9.2.tar.gz' Content type 'application/x-gzip' length 756463 bytes (738 KB) downloaded 738 KB

The downloaded source packages are in ‘C:\Users\claire.richards\AppData\Local\Temp\Rtmp4aPeoV\downloaded_packages’ Warning message: In install.packages("TMB", type = "source") : installation of package ‘TMB’ had non-zero exit status

bbolker commented 1 year ago

Just to be clear, here is the recommend brute-force approach:

  1. Make sure that you have development tools installed. See here for MacOS and here for Windows (if you're on Linux, you probably know what you're doing with this ...)
  2. start a clean R/RStudio session (make sure no packages other than the base/core packages are loaded)
  3. install.packages("Matrix") - this should install the latest version of Matrix
  4. install.package("TMB", type = "source") - this installs the latest version of TMB in a way that is binary-compatible with the latest Matrix
  5. install.package("glmmTMB", type = "source") - this installs the latest version of glmmTMB in a way that is *binary-compatible with the latest TMB

We could make life a little easier by population our local repository with latest-compatible versions of TMB and glmmTMB but that's about an hour's work and I just haven't gotten around to it ...

clairerichardsRN commented 1 year ago

@bbolker Thank you, that worked!!

bbolker commented 1 year ago

@kaskr @mebrooks: what do you think about adding my checklist above to the reinstalling help page? (Also needs to be updated because MRAN no longer exists, so the advice to use checkpoint() to revert packages presumably won't work either.) (This blog post talks about what to do in the absence of MRAN, but it's harder/more technical than "install dev tools and install from source")

rhothygesen commented 1 year ago

Hi,

I am having the worst time trying to get glmmTMB on my MacOS Ventura. I followed the instructions @bbolker suggested (the brute-force ones). I've tried shutting the computer down, re-installing R, changing my CRAN windows, and downloading glmmTMB from Github directly through the zip file. Here is what I am seeing after every attempt at install.packages("glmmTMB"). help!

ERROR: dependency ‘TMB’ is not available for package ‘glmmTMB’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/glmmTMB’
Warning in install.packages :
  installation of package ‘glmmTMB’ had non-zero exit status
bbolker commented 1 year ago

Hmm. R version 4.1 is a bit old, but the version of TMB on CRAN doesn't require a recent version of R, and there appear to be up-to-date binaries for arm64. What do you get from install.packages("TMB") (or install.packages("TMB", type = "source") ? Are you indeed using R version 4.1.(something)?

rhothygesen commented 1 year ago

Thanks for responding. Here is my version of R: Version 2023.09.0+463 (2023.09.0+463).

When I tryinstall.packages("TMB"):

Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘TMB’
Do you want to attempt to install these from sources? (Yes/no/cancel) 
installing the source package ‘TMB’

trying URL 'https://cran.rstudio.com/src/contrib/TMB_1.9.6.tar.gz'
Content type 'application/x-gzip' length 761774 bytes (743 KB)
==================================================
downloaded 743 KB

* installing *source* package ‘TMB’ ...
** package ‘TMB’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c external_metis.c -o external_metis.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c init.c -o init.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c local_stubs.c -o local_stubs.o
In file included from local_stubs.c:4:
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include/Matrix_stubs.c:614:36: warning: '/*' within block comment [-Wcomment]
 *-  Common->print_function = NULL;/* was  R_cholmod_printf; /.* Rprintf gives warning */
                                   ^
1 warning generated.
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c solve_subset.c -o solve_subset.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c utils.c -o utils.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o TMB.so external_metis.o init.o local_stubs.o solve_subset.o utils.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [TMB.so] Error 1
ERROR: compilation failed for package ‘TMB’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/TMB’
Warning in install.packages :
  installation of package ‘TMB’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/qv/jlqj5vvd19lct7ss59b653v80000gn/T/Rtmp7fo1VR/downloaded_packages’

When I try install.packages("TMB", type = "source"):

trying URL 'https://cran.rstudio.com/src/contrib/TMB_1.9.6.tar.gz'
Content type 'application/x-gzip' length 761774 bytes (743 KB)
==================================================
downloaded 743 KB

* installing *source* package ‘TMB’ ...
** package ‘TMB’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c external_metis.c -o external_metis.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c init.c -o init.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c local_stubs.c -o local_stubs.o
In file included from local_stubs.c:4:
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include/Matrix_stubs.c:614:36: warning: '/*' within block comment [-Wcomment]
 *-  Common->print_function = NULL;/* was  R_cholmod_printf; /.* Rprintf gives warning */
                                   ^
1 warning generated.
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c solve_subset.c -o solve_subset.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Matrix/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppEigen/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c utils.c -o utils.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o TMB.so external_metis.o init.o local_stubs.o solve_subset.o utils.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [TMB.so] Error 1
ERROR: compilation failed for package ‘TMB’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/TMB’
Warning in install.packages :
  installation of package ‘TMB’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/qv/jlqj5vvd19lct7ss59b653v80000gn/T/Rtmp7fo1VR/downloaded_packages’
bbolker commented 1 year ago

You don't appear to have gfortran installed. I think that binaries aren't available for R 4.1 because MacOS Ventura was released in October 2022, at which time R 4.2 was current (released April 2022). You either need to install gfortran (see the CRAN MacOS page for a download link) or update your version of R to a more current version. If you don't have administrative reasons that force you to stick with R 4.1.x, it will make your life much easier to upgrade to the most recent version of R (4.3.1). (The version number you give above is an RStudio version number, not an R version number ...)

rhothygesen commented 1 year ago

Thank you, I got the package now. I didn't realize I still had a very old version of R on my laptop from years ago!