New to RStudio, problem installing vegan package

Hi, I'm new to R Studio and I'm intimidated with the package installation.

I can't install "vegan".

I already did the following:

  1. temrinal: xcode-select --install
  2. installed the latest version (intel) of gfortan 12.1(Releases · fxcoudert/gfortran-for-macOS · GitHub)

This is the last error I get:

> install.packages("vegan")

  There is a binary version available but the source version is later:
      binary source needs_compilation
vegan  2.6-2  2.6-4              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes
installing the source package ‘vegan’

trying URL 'https://cran.rstudio.com/src/contrib/vegan_2.6-4.tar.gz'
Content type 'application/x-gzip' length 1496110 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package ‘vegan’ ...
** package ‘vegan’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c data2hill.c -o data2hill.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c decorana.f -o decorana.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c getF.c -o getF.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c goffactor.c -o goffactor.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init.c -o init.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c monoMDS.f -o monoMDS.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c nestedness.c -o nestedness.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c ordering.f -o ordering.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c pnpoly.c -o pnpoly.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c stepacross.c -o stepacross.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c vegdist.c -o vegdist.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o vegan.so data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: dylib (/usr/local/gfortran/lib/libquadmath.dylib) was built for newer macOS version (12.3) than being linked (10.13)
installing to /Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-vegan/00new/vegan/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘vegan’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-vegan/00new/vegan/libs/vegan.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-vegan/00new/vegan/libs/vegan.so, 0x0006): symbol not found in flat namespace (__gfortran_os_error_at)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/vegan’
Warning in install.packages :
  installation of package ‘vegan’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/n3/hytr03qx30v_r4kr_g2z6n840000gn/T/RtmpXq3VHL/downloaded_packages’

I appreaciate your help with this issue!There are some packages I have been able to download, but I got stuck with vegan...

Thanks in advance!
Malena

"no" should solve the issue

1 Like

So simple and effective :slight_smile:

WOuld you mind explaining what are the differences between compiling or not? Should I always say no? Why does it happen?

Sorry, I'm very new to coding.

When you answer no, you are installing a precompiled binary (which is a little older), CRAN takes a few days to compile binaries when a new package version is published and they are only available for the latest R version.

If you need to install the latest version of a package and there are no precompiled binaries available at the time, then you have to compile yourself.

1 Like

Thank you for your explanation!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.