benjjneb / dada2

Accurate sample inference from amplicon data with single nucleotide resolution
http://benjjneb.github.io/dada2/
GNU Lesser General Public License v3.0
470 stars 142 forks source link

Problems with install DADA2 in R version 4.1 #1404

Closed Alejandra31pucv closed 5 months ago

Alejandra31pucv commented 3 years ago

I have problems intalling DADA2 in the latest version of R 4.1

Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.1 (2021-08-10) Installation paths not writeable, unable to update packages path: C:/Program Files/R/R-4.1.1/library packages: survival Warning message: package(s) not installed when version(s) same as current; use force = TRUE to re-install: 'dada2'

benjjneb commented 3 years ago

The warning message does not indicate a problem installing dada2, just that the same version of the package is already there, so it wasn't reinstalled.

If library(dada2); packageVersion("dada2") works, then you are good to go.

CaraFiore commented 3 years ago

Hello, I am working with students who are trying to install dada2 with R 4.1 on their mac computers and having the same issue - however, when they try to load the library, it says "not found" so the dada2 package is not installed. We tried the notes for install issues that are linked on the dada2 tutorial but that is not working either. Here is the code entered: if (!requireNamespace("BiocManager", quietly = TRUE))

BiocManager::install("dada2")

Here is the installation output (it looks like it starts to install fine):

_'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details

replacement repositories: CRAN: https://cran.rstudio.com/

Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.1 (2021-08-10) Installing package(s) 'dada2' also installing the dependencies ‘Rsamtools’, ‘GenomicAlignments’, ‘Rhtslib’, ‘ShortRead’

Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘Rsamtools’ ‘GenomicAlignments’ ‘Rhtslib’ ‘ShortRead’ ‘dada2’ Do you want to attempt to install these from sources? (Yes/no/cancel) yes installing the source packages ‘Rsamtools’, ‘GenomicAlignments’, ‘Rhtslib’, ‘ShortRead’, ‘dada2’

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/Rsamtools_2.8.0.tar.gz' Content type 'application/x-gzip' length 2870315 bytes (2.7 MB)

downloaded 2.7 MB

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/GenomicAlignments_1.28.0.tar.gz' Content type 'application/x-gzip' length 2301182 bytes (2.2 MB)

downloaded 2.2 MB

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/Rhtslib_1.24.0.tar.gz' Content type 'application/x-gzip' length 1471711 bytes (1.4 MB)

downloaded 1.4 MB

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/ShortRead_1.50.0.tar.gz' Content type 'application/x-gzip' length 5184732 bytes (4.9 MB)

downloaded 4.9 MB

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/dada2_1.20.0.tar.gz' Content type 'application/x-gzip' length 2871808 bytes (2.7 MB)

downloaded 2.7 MB

The downloaded source packages are in ‘/private/var/folders/tc/292_d7rn4b77n2ky2cfyd3lh0000gn/T/RtmpRKowar/downloaded_packages’ Old packages: 'mgcv' Update all/some/none? [a/s/n]: a Warning: unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' Warning: unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' Warning: unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' Warning: unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' Warning: unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'

There is a binary version available but the source version is later: binary source needs_compilation mgcv 1.8-36 1.8-37 TRUE

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

trying URL 'https://cran.rstudio.com/src/contrib/mgcv_1.8-37.tar.gz' Content type 'application/x-gzip' length 1175506 bytes (1.1 MB)

downloaded 1.1 MB

The downloaded source packages are in ‘/private/var/folders/tc/292_d7rn4b77n2ky2cfyd3lh0000gn/T/RtmpRKowar/downloaded_packages’ There were 11 warnings (use warnings() to see them)

Test the installation:

library(dada2) Error in library(dada2) : there is no package called ‘dada2’_

Also, when we tried the install option for if you run into dependency issues (https://benjjneb.github.io/dada2/dada-installation.html), we got the following message (including if we use the updated short read for R 4.1 - we only tried this for ShortRead):

_ERROR: dependency ‘ShortRead’ is not available for package ‘dada2’

Any insight is appreciated and thank you for your time.

benjjneb commented 3 years ago

Please see the answer/solution for this issue on the Bioconductor forum: https://support.bioconductor.org/p/9137290/

Short version, for the time being using Bioconductor/R via Rosetta emulation mode on M1 Macs will be easier to manage.

cjfields commented 3 years ago

EDIT: See also issue #1375

Just a note for the adventurous types trying to compile dada2 native M1, you can get part of the way there by installing the M1-compiled dependencies here: https://mac.r-project.org/libs-arm64/ (see the instructions at the bottom of that page for downloading and installing). You need (minimally) gfortran and xz to get Rsamtools and ShortRead installed.

However, currently dada2 still fails from a core library, which may be harder to overcome as it appears to be pulled in from Rmain.cpp (see #error this header is for x86 only below):

> BiocManager::install('dada2')
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details

replacement repositories:
    CRAN: https://cran.rstudio.com/

Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.1 (2021-08-10)
Installing package(s) 'dada2'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘dada2’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘dada2’

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/dada2_1.20.0.tar.gz'
Content type 'application/x-gzip' length 2871808 bytes (2.7 MB)
==================================================
downloaded 2.7 MB

* installing *source* package ‘dada2’ ...
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppParallel/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dada2.h:7:
./../inst/include/dada2_RcppExports.h:14:14: warning: unused function 'validateSignature' [-Wunused-function]
        void validateSignature(const char* sig) {
             ^
1 warning generated.
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppParallel/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c Rmain.cpp -o Rmain.o
In file included from Rmain.cpp:7:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:14:2: error: this header is for x86 only
#error this header is for x86 only
 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:286:5: error: invalid output constraint '=a' in asm
    __cpuid(__leaf, __eax, __ebx, __ecx, __edx);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:251:11: note: expanded from macro '__cpuid'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:301:5: error: invalid output constraint '=a' in asm
    __cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:251:11: note: expanded from macro '__cpuid'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:315:5: error: invalid output constraint '=a' in asm
    __cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:258:11: note: expanded from macro '__cpuid_count'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
Rmain.cpp:9:3: error: invalid output constraint '=a' in asm
  __cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/cpuid.h:258:11: note: expanded from macro '__cpuid_count'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
5 errors generated.
make: *** [Rmain.o] Error 1
ERROR: compilation failed for package ‘dada2’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/dada2’

The downloaded source packages are in
    ‘/private/var/folders/ww/w72_l7wx16z1yrlx9s_4bzxc0000gn/T/RtmpHQVsDB/downloaded_packages’
Warning messages:
1: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
2: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
3: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
4: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
5: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
6: In .inet_warning(msg) :
  installation of package ‘dada2’ had non-zero exit status
GiulianoColosimo commented 2 years ago

I am having the exact same issue as @cjfields Some posts suggest to go back to an R installation specific for NON-arm64 processors and use Rosetta emulators. Not sure if I want to go that way. Does anyone know how if/when/how this issue could/will be solved?

benjjneb commented 2 years ago

@GiulianoColosimo Thanks for the ping on this. I am now in possession of an M1 Macbook Pro, so this is something I should revisit. All the x86 specific vectorized code is contained and can be bypassed by a simple flag, so a fix should be straightforward I think. In fact this pull request https://github.com/benjjneb/dada2/pull/1147 may already do the trick, I just hadn't been able to test it on an ARM system until recently.

GiulianoColosimo commented 2 years ago

@benjjneb Thanks for getting back on this. I have looked at the pull request you mentioned. Using the see2neon solution seems a little above my pay grade, but I am ready to go that way if I cannot have dada2 work. I am running on a MBPro with M1 Pro. Just a little afraid of doing something I do not completely understand eheh.

wolfganghuber commented 2 years ago

Hi, I'm having the same problem while trying to install dada2 on my ARM64 Macbook, found this thread via Google, and am wondering whether the problem has already been resolved? I'm using dada2_1.23.0.tar.gz from http://bioconductor.org/packages/devel/bioc/html/dada2.html and R version 4.2.0 aarch64-apple-darwin20 (64-bit) running under macOS Monterey 12.3.1. I'm trying the build the MSMB book with Susan, hundreds of other CRAN and Bioconductor packages have been installed, dada2 is the last one that is missing...

clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RcppParallel/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c Rmain.cpp -o Rmain.o
In file included from Rmain.cpp:7:
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/cpuid.h:14:2: error: this header is for x86 only
#error this header is for x86 only
benjjneb commented 2 years ago

@wolfganghuber Sorry for slow response. No this isn't solved yet. I do now have a working branch on my new M1 Mac, largely based on the previous PR by @terjekv: https://github.com/benjjneb/dada2/pull/1147

I'm still in the process of transferring my "working environment" over to my new M1 mac, but right now I anticipate getting this pushed up to the devel branch in the next week or two.

Cecilia-Wang commented 2 years ago

Hi there,

I have been able to install most R packages (under R version 4.2.1) I need with the M1 MB pro, except for dada2. I was just wondering if there is any update.

benjjneb commented 2 years ago

Sorry for this being delayed. This fix will be in (to natively compile on arm64 architectures like the M1) in the next release of dada2 this Fall. (And hopefully much sooner on the devel branch)

benjjneb commented 2 years ago

Quick update, the latest release (package version 1.26, in Bioconductor 1.16) now supports ARM architectures.

Github release link: https://github.com/benjjneb/dada2/releases/tag/v1.26

BioC release link: https://bioconductor.org/packages/release/bioc/html/dada2.html

cjfields commented 2 years ago

I'll give it a try, thanks @benjjneb !

wolfganghuber commented 1 year ago

That’s great! Thank you, Ben. Now I seem to be able to build the MSMB book on ARM. Kind regards Wolfgang


Wolfgang Huber EMBL — https://www.embl.org/groups/huber

Il giorno 03.11.2022, alle ore 22:29, Benjamin Callahan @.***> ha scritto:

Quick update, the latest release (package version 1.26, in Bioconductor 1.16) now supports ARM architectures. Github release link: https://github.com/benjjneb/dada2/releases/tag/v1.26 BioC release link: https://bioconductor.org/packages/release/bioc/html/dada2.html — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

cwbeltz commented 1 year ago

Thank you for the work on this @benjjneb ! I've been keeping an eye out for this and looking forward to using it on some re-analysis.

cjfields commented 1 year ago

This installed without issue, thanks @benjjneb

luigallucci commented 9 months ago

@benjjneb I'm trying to install dada2 with last version of Bioconductor on my new mac, but it fail to complete the installation of different dependencies.

In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:37:
In file included from ../inst/include/unsupported/Eigen/SparseExtra:51:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:33: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
   14 |     #pragma clang diagnostic pop
      |                                 ^
17 warnings and 1 error generated.
make: *** [/Users/lgallucc/miniforge3/envs/downstream/lib/R/etc/Makeconf:200: RcppEigen.o] Error 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/Users/lgallucc/miniforge3/envs/downstream/lib/R/library/RcppEigen’
ERROR: dependency ‘RcppEigen’ is not available for package ‘interp’
* removing ‘/Users/lgallucc/miniforge3/envs/downstream/lib/R/library/interp’
ERROR: dependency ‘interp’ is not available for package ‘latticeExtra’
* removing ‘/Users/lgallucc/miniforge3/envs/downstream/lib/R/library/latticeExtra’
ERROR: dependency ‘latticeExtra’ is not available for package ‘ShortRead’
* removing ‘/Users/lgallucc/miniforge3/envs/downstream/lib/R/library/ShortRead’
ERROR: dependency ‘ShortRead’ is not available for package ‘dada2’
* removing ‘/Users/lgallucc/miniforge3/envs/downstream/lib/R/library/dada2’

I pacchetti scaricati con il codice sorgente sono in
    ‘/private/var/folders/pk/vwt_djyd69z9cf72qw4shc_m0000gq/T/RtmpGZEvcf/downloaded_packages’
Aggiornamento indice HTML dei pacchetti in '.Library'
Making 'packages.html' ... fatto
Messaggi di avvertimento:
1: In install.packages(...) :
  l'installazione del pacchetto ‘RcppEigen’ ha uno stato di uscita non-zero
2: In install.packages(...) :
  l'installazione del pacchetto ‘interp’ ha uno stato di uscita non-zero
3: In install.packages(...) :
  l'installazione del pacchetto ‘latticeExtra’ ha uno stato di uscita non-zero
4: In install.packages(...) :
  l'installazione del pacchetto ‘ShortRead’ ha uno stato di uscita non-zero
5: In install.packages(...) :
  l'installazione del pacchetto ‘dada2’ ha uno stato di uscita non-zero

Suggestion? It's first time working on a Mac, I always used a ubuntu computer.

benjjneb commented 9 months ago

@luisymbio Since this is not being caused by dada2, but rather by the failed dependency RcppEigen, I would recommend trying the Bioconductor support site: https://support.bioconductor.org/

I don't have anything intelligent to say about why RcppEigen is failing.