problems about installation of package ‘Rhtslib’, ‘Rsamtools’ ,‘GenomicAlignments’ , ‘ShortRead’ on macOS Big Sur using R 4.1.0
3
6
Entering edit mode
lh290 ▴ 60
@37be8c18
Last seen 3.5 years ago
China

I am trying to install Rhtslib on macOS Big Sur M1 using R 4.1.0. But I get the following error. And this problem is not unique to me, I have found there are other users with the same problems in github.



Bioconductor version 3.13 (BiocManager 1.30.15), R 4.1.0 (2021-05-18)
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) 
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

* installing *source* package ‘Rhtslib’ ...
** using non-staged installation via StagedInstall field
** libs
cd "htslib-1.7" && make -f "/Library/Frameworks/R.framework/Resources/etc/Makeconf" -f "Makefile.Rhtslib"
Makefile.Rhtslib:128: warning: overriding commands for target `.c.o'
/Library/Frameworks/R.framework/Resources/etc/Makeconf:168: warning: ignoring old commands for target `.c.o'
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o kfunc.o kfunc.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o knetfile.o knetfile.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o kstring.o kstring.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o bcf_sr_sort.o bcf_sr_sort.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o bgzf.o bgzf.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o errmod.o errmod.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o faidx.o faidx.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o hfile.o hfile.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o hfile_net.o hfile_net.c
echo '#define HTS_VERSION "1.7"' > version.h
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o hts.o hts.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o hts_os.o hts_os.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o md5.o md5.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o multipart.o multipart.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o probaln.o probaln.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o realn.o realn.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o regidx.o regidx.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o sam.o sam.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o synced_bcf_reader.o synced_bcf_reader.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o vcf_sweep.o vcf_sweep.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o tbx.o tbx.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o textutils.o textutils.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o thread_pool.o thread_pool.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o vcf.o vcf.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o vcfutils.o vcfutils.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_codecs.o cram/cram_codecs.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_decode.o cram/cram_decode.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_encode.o cram/cram_encode.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_external.o cram/cram_external.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_index.o cram/cram_index.c
clang -arch arm64 -falign-functions=64 -Wall -g -O2  -fpic -I. -I/opt/R/arm64/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_io.o cram/cram_io.c
cram/cram_io.c:61:10: fatal error: 'lzma.h' file not found
#include <lzma.h>
         ^~~~~~~~
1 error generated.
make[1]: *** [cram/cram_io.o] Error 1
make: *** [htslib] Error 2
ERROR: compilation failed for package ‘Rhtslib’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rhtslib’
ERROR: dependency ‘Rhtslib’ is not available for package ‘Rsamtools’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rsamtools’
ERROR: dependency ‘Rsamtools’ is not available for package ‘GenomicAlignments’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/GenomicAlignments’
ERROR: dependencies ‘Rsamtools’, ‘GenomicAlignments’, ‘Rhtslib’ are not available for package ‘ShortRead’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/ShortRead’
ERROR: dependency ‘ShortRead’ is not available for package ‘dada2’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/dada2’

The downloaded source packages are in
    ‘/private/var/folders/yn/fdgc5kpj3056n7nw_g3wsf780000gn/T/RtmpHqRdfV/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 ‘Rhtslib’ had non-zero exit status
7: In .inet_warning(msg) :
  installation of package ‘Rsamtools’ had non-zero exit status
8: In .inet_warning(msg) :
  installation of package ‘GenomicAlignments’ had non-zero exit status
9: In .inet_warning(msg) :
  installation of package ‘ShortRead’ had non-zero exit status

i would be grateful if the relevant people can pay attention to this problem and offer me some suggestion.

dada2 • 18k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
17
Entering edit mode
@herve-pages-1542
Last seen 2 days ago
Seattle, WA, United States

Hi,

Note that you are using a version of R that was compiled for macOS-arm64, probably R-4.1.0-arm64.pkg from CRAN.

Please be aware that Bioconductor does not support the Apple M1 (a.k.a. arm64) architecture in native mode yet, only via Rosetta, which is the emulator built into macOS Big Sur that enables Mac M1 systems to run Intel x86_64 apps. Concretely this means that if you are on an Apple M1 system, we strongly recommend that you use the official Intel 64-bit R (x86_64 arch) from CRAN available here: https://cran.r-project.org/bin/macosx/ (choose R-4.1.0.pkg, NOT R-4.1.0-arm64.pkg). This will run on the Apple M1 platform in emulation mode.

The great benefit of doing this is that you will then be using something that we do support. In particular you'll be able to install Intel 64-bit Mac binary packages from CRAN and Bioconductor, including the Mac binary for Rhtslib which should install and work out-of-the-box without any compilation/linking/headache involved. Installing binary packages is also _much_ faster.

Best,

H.

ADD COMMENT
1
Entering edit mode

This should be pinned to the top of the internet!

Thank you!

ADD REPLY
0
Entering edit mode

THANK YOU!!! IT WORKS

ADD REPLY
0
Entering edit mode

I met the same problem two days ago ,found a lot of answers but not solve this issue , by adapting your way ,it works!!! thank you !!!

ADD REPLY
0
Entering edit mode

Is this still the recommended solution for the above problem? Or does bioconductor support the M1 architecture now?

ADD REPLY
0
Entering edit mode

I banged my head against the wall all day yesterday on this exact problem, installed intel R as described above, and it worked first try. So it appears as though yes this is still the fix.

ADD REPLY
0
Entering edit mode

It's really great!!!!

ADD REPLY
3
Entering edit mode
Chris Fields ▴ 90
@chris-fields-4329
Last seen 2.7 years ago
United States

In case anyone runs into this and wants to be all cutting-edge like and attempt sticking with a native M1 version, you can install various arm64-compiled packages and tools for M1:

https://mac.r-project.org/libs-arm64/

In particular, for Rsamtools the following worked for me:

curl -O https://mac.r-project.org/libs-arm64/gfortran-f51f1da0-darwin20.0-arm64.tar.gz
curl -O https://mac.r-project.org/libs-arm64/xz-5.2.5-darwin.20-arm64.tar.gz

sudo tar -fvxz gfortran-f51f1da0-darwin20.0-arm64.tar.gz -C /
sudo tar -fvxz xz-5.2.5-darwin.20-arm64.tar.gz -C /

Also, see https://pat-s.me/transitioning-from-x86-to-arm64-on-macos-experiences-of-an-r-user/ for a nice overview on where things are right now.

ADD COMMENT
0
Entering edit mode

This worked for me too. Thank you. R version 4.1.3 (2022-03-10) macOS 12.3.1 (Monterey)

ADD REPLY
0
Entering edit mode

@chris-fields-4329, sorry, this doesn't work for me now, probably because of the version mismatch. I tried with the advise from https://pat-s.me/transitioning-from-x86-to-arm64-on-macos-experiences-of-an-r-user/ also, with no avail. Please see the two examples below:

  1. install.packages("cluster", type = "source")
    ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1'
    ld: library not found for -lemutls_w
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
  1. BiocManager::install("DESeq2")
    ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.6.0/12.0.1'
    ld: library not found for -lemutls_w
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [genefilter.so] Error 1
    ERROR: compilation failed for package ‘genefilter’
    * removing ‘/Users/massisenergy/Library/R/arm64/4.2/library/genefilter’
    ERROR: dependency ‘genefilter’ is not available for package ‘DESeq2’
    * removing ‘/Users/massisenergy/Library/R/arm64/4.2/library/DESeq2’

But when I use these commands, the version is 20.2.0/11.0.0 in stead of what my package installations want 20.6.0/12.0.1 (check previous):

$ sudo tar fvxz xz-5.2.5-darwin.20-arm64.tar.gz -C /
x opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0/include/float.h
x opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0/include/arm_acle.h
x opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0/include/openacc.h
x opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0/include/arm_fp16.h
x opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0/include/stddef.h
  • System information: M1Pro, Ventura.

    > R.version
    platform aarch64-apple-darwin20
    arch aarch64
    os darwin20
    system aarch64, darwin20
    status
    major 4
    minor 2.1
    year 2022
    month 06
    day 23
    svn rev 82513
    language R
    version.string R version 4.2.1 (2022-06-23) nickname Funny-Looking Kid

Feels like it's just a bit to be able to run native arm64 R, any help would be greatly appreciated!

ADD REPLY
0
Entering edit mode

I'm running into exactly the same problem. Did you find a solution?

ADD REPLY
0
Entering edit mode
lionzord • 0
@757ba5c5
Last seen 2.3 years ago
United States

The issue is related to where R thinks the library gfortran lives. This post really helped me fixe the issues with the new installation and wanted to share it with you.

https://pat-s.me/transitioning-from-x86-to-arm64-on-macos-experiences-of-an-r-user/

ADD COMMENT

Login before adding your answer.

Traffic: 956 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6