简体   繁体   English

无法再安装任何 R 包

[英]Can't install any R packages anymore

I use for biological data analysis.我使用进行生物数据分析。 I'm on a Mac OS Catalina 10.15.4 .我在Mac OS Catalina 10.15.4 I recently updated R to version 3.6.3 because I thought that would solve my inability to install a particular package: DESeq2 .我最近将 R 更新到version 3.6.3因为我认为这可以解决我无法安装特定软件包的问题: DESeq2 Huge mistake - amongst the many I've probably made in trying to troubleshoot without really understanding what the problem is.巨大的错误 - 在我尝试排除故障时可能犯的许多错误中,我没有真正了解问题所在。 I'm not able to install ANY packages now.我现在无法安装任何软件包。 I had updated my Clang version when I went down the rabbit hole of potential solutions on the internet.当我在互联网上寻找潜在解决方案的兔子洞时,我更新了我的 Clang 版本。 I was going to upgrade too, but I want to understand what the problem is really before I blindly try more.我也打算升级 ,但我想在盲目尝试更多之前了解问题的真正含义。

Now I've downgraded to R 3.5.3 (I'd like to stick to this R version).现在我已经降级到R 3.5.3 (我想坚持这个 R 版本)。

Qst: Using R 3.5.3, how do I successfully install packages from CRAN again? Qst:使用 R 3.5.3,如何再次从 CRAN 成功安装软件包? And also from Bioconductor like the DESeq2 package?还有来自 Bioconductor 的 DESeq2 包?

Error warning below:错误警告如下:

install.packages("readr")
 Warning in install.packages : unable to access index for repository http://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5: cannot open URL 'http://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/PACKAGES' Package which is only available in source form, and may need compilation of C/C++/Fortran: 'readr' Do you want to attempt to install these from sources? (Yes/no/cancel) y installing the source package 'readr' trying URL 'http://cran.rstudio.com/src/contrib/readr_1.3.1.tar.gz' Content type 'application/x-gzip' length 268853 bytes (262 KB) ================================================== downloaded 262 KB * installing *source* package 'readr' ... ** package 'readr' successfully unpacked and MD5 sums checked ** libs clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c Collector.cpp -o Collector.o clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c CollectorGuess.cpp -o CollectorGuess.o clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c Iconv.cpp -o Iconv.o clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c LocaleInfo.cpp -o LocaleInfo.o clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c Reader.cpp -o Reader.o In file included from Reader.cpp:1: In file included from ./Reader.h:3: In file included from ./Collector.h:5: In file included from ./DateTimeParser.h:6: In file included from ./QiParsers.h:4: In file included from ./boost.h:6: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: unknown type name 'uuid_t' int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA); ^ In file included from Reader.cpp:1: In file included from ./Reader.h:3: In file included from ./Collector.h:5: In file included from ./DateTimeParser.h:6: In file included from ./QiParsers.h:4: In file included from ./boost.h:6: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'? int getsgroups_np(int *, uuid_t); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here typedef __darwin_uid_t uid_t; ^ In file included from Reader.cpp:1: In file included from ./Reader.h:3: In file included from ./Collector.h:5: In file included from ./DateTimeParser.h:6: In file included from ./QiParsers.h:4: In file included from ./boost.h:6: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'? int getwgroups_np(int *, uuid_t); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here typedef __darwin_uid_t uid_t; ^ In file included from Reader.cpp:1: In file included from ./Reader.h:3: In file included from ./Collector.h:5: In file included from ./DateTimeParser.h:6: In file included from ./QiParsers.h:4: In file included from ./boost.h:6: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'? int setsgroups_np(int, const uuid_t); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here typedef __darwin_uid_t uid_t; ^ In file included from Reader.cpp:1: In file included from ./Reader.h:3: In file included from ./Collector.h:5: In file included from ./DateTimeParser.h:6: In file included from ./QiParsers.h:4: In file included from ./boost.h:6: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'? int setwgroups_np(int, const uuid_t); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here typedef __darwin_uid_t uid_t; ^ 5 errors generated. make: *** [Reader.o] Error 1 ERROR: compilation failed for package 'readr' * removing '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/readr' Warning in install.packages : installation of package 'readr' had non-zero exit status The downloaded source packages are in '/private/var/folders/49/18qlr0bn7xg_mk2pzxvrb0f80000gn/T/RtmpN5hCja/downloaded_packages'

Appreciate your help.感谢你的帮助。

I've had the same problem on my Mac!我在 Mac 上遇到了同样的问题! I'm running Mojave.我正在运行莫哈韦沙漠。 It appears there has been an issue with CRAN recently.最近似乎 CRAN 出现了问题。 Add the following repo argument has worked for me:添加以下 repo 参数对我有用:

install.packages("readr", repo = 'https://mac.R-project.org')

More info: https://community.rstudio.com/t/i-can-t-install-packages-on-r-studio-non-zero-exit-status/52135更多信息: https : //community.rstudio.com/t/i-can-t-install-packages-on-r-studio-non-zero-exit-status/52135

I think the problem is the type uuid_t is not defined at anywhere.我认为问题是 uuid_t 类型没有在任何地方定义。 So the declaration at line 662 in the file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h will cause error for example.因此,例如,文件/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h第 662 行的声明将导致错误。

In the first attempt, I tried to add one line into that unistd.h file: #include at line 83 .在第一次尝试中,我尝试在 unistd.h 文件中添加一行: #include at line 83 But it doesn't help.但它没有帮助。

Because I don't want to go deeper to edit many system file, I add another line into unistd.h to manually define the type of uuid_t, based on the definition in _uuid_t.h.因为我不想深入编辑很多系统文件,所以我在 unistd.h 中添加了另一行,以根据 _uuid_t.h 中的定义手动定义 uuid_t 的类型。 typedef __darwin_uuid_t uuid_t; typedef __darwin_uuid_t uuid_t; at line 661 , after "#endif" .第 661 行,在"#endif" 之后

Then it worked.然后它起作用了。

I am not sure if this is an error in the source code of MacOSX.10.15.sdk or not.我不确定这是否是 MacOSX.10.15.sdk 源代码中的错误。 But if you want to fix it in this way, please make sure you have the root permission when editing those files.但是,如果您想以这种方式修复它,请确保您在编辑这些文件时具有 root 权限。

I relied on these 2 posts to solve my issue:我依靠这两个帖子来解决我的问题:

https://www.nistara.net/post/compile-issues-r/ https://www.nistara.net/post/compile-issues-r/

https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/ https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/

Thanks to the Coatless Professor and Nistara Randhawa感谢无衣教授和 Nistara Randhawa

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM