微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

R包存放在错误的地方

如何解决R包存放在错误的地方

我希望 R 在 Rstudio 和 Jupiter notebook 上都能顺利运行。

我遇到了一些字体不可用的问题,所以今天我重新安装了 R 和 Rstudio,并在整个计算机上提供了必要的字体。因此,我不再有字体问题。

但是现在当我尝试重新安装所需的软件包时,R 无法访问它们。例如,当我尝试安装 dplyr 时,会发生这种情况:

> install.packages("dplyr")
also installing the dependencies 'pillar','lifecycle','rlang','tibble','tidyselect','vctrs'

trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.6.0.tar.gz'
Content type 'application/x-gzip' length 1100197 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.0.tar.gz'
Content type 'application/x-gzip' length 83389 bytes (81 KB)
==================================================
downloaded 81 KB

trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.10.tar.gz'
Content type 'application/x-gzip' length 915685 bytes (894 KB)
==================================================
downloaded 894 KB

trying URL 'https://cran.rstudio.com/src/contrib/tibble_3.1.1.tar.gz'
Content type 'application/x-gzip' length 686855 bytes (670 KB)
==================================================
downloaded 670 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyselect_1.1.0.tar.gz'
Content type 'application/x-gzip' length 90842 bytes (88 KB)
==================================================
downloaded 88 KB

trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.7.tar.gz'
Content type 'application/x-gzip' length 782590 bytes (764 KB)
==================================================
downloaded 764 KB

trying URL 'https://cran.rstudio.com/src/contrib/dplyr_1.0.5.tar.gz'
Content type 'application/x-gzip' length 949019 bytes (926 KB)
==================================================
downloaded 926 KB

During startup - Warning messages:
1: Setting LC_CTYPE Failed,using "C" 
2: Setting LC_TIME Failed,using "C" 
3: Setting LC_MESSAGES Failed,using "C" 
4: Setting LC_MONETARY Failed,using "C" 
* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/tinius/opt/anaconda3/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/tinius/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/tinius/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/tinius/opt/anaconda3=/usr/local/src/conda-prefix  -c capture.c -o capture.o
/bin/sh: x86_64-apple-darwin13.4.0-clang: command not found
make: *** [capture.o] Error 127
ERROR: compilation Failed for package 'rlang'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/rlang'
* restoring prevIoUs '/Users/tinius/opt/anaconda3/lib/R/library/rlang'
Warning in install.packages :
  installation of package 'rlang' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE Failed,using "C" 
* installing *source* package 'lifecycle' ...
** package 'lifecycle' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
During startup - Warning messages:
1: Setting LC_CTYPE Failed,using "C" 
Error in loadNamespace(i,c(lib.loc,.libPaths()),versionCheck = vI[[i]]) : 
  namespace 'rlang' 0.4.5 is being loaded,but >= 0.4.10 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading Failed for package 'lifecycle'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/lifecycle'
Warning in install.packages :
  installation of package 'lifecycle' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE Failed,using "C" 
* installing *source* package 'vctrs' ...
** package 'vctrs' successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/tinius/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/tinius/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/tinius/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/tinius/opt/anaconda3=/usr/local/src/conda-prefix  -c altrep-rle.c -o altrep-rle.o
/bin/sh: x86_64-apple-darwin13.4.0-clang: command not found
make: *** [altrep-rle.o] Error 127
ERROR: compilation Failed for package 'vctrs'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/vctrs'
Warning in install.packages :
  installation of package 'vctrs' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE Failed,using "C" 
ERROR: dependencies 'lifecycle','vctrs' are not available for package 'pillar'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/pillar'
Warning in install.packages :
  installation of package 'pillar' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE Failed,using "C" 
ERROR: dependency 'vctrs' is not available for package 'tidyselect'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/tidyselect'
Warning in install.packages :
  installation of package 'tidyselect' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE Failed,'pillar','vctrs' are not available for package 'tibble'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/tibble'
Warning in install.packages :
  installation of package 'tibble' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE Failed,'vctrs' are not available for package 'dplyr'
* removing '/Users/tinius/opt/anaconda3/lib/R/library/dplyr'
Warning in install.packages :
  installation of package 'dplyr' had non-zero exit status

The downloaded source packages are in
    '/private/var/folders/wp/g4z3sz4d2tvd5sx0s5r796xw0000gn/T/RtmpVNkKcX/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

所以看起来软件包安装在 anaconda 下(我使用过 Jupiter notebook 以及 Rstudio for R)。当我运行 .libPaths 时,我得到 [1] "/Users/tinius/opt/anaconda3/lib/R/library"

here 我看到“建议”的路径与我拥有的路径根本不同。

如果有人能够帮助我,我将不胜感激!

我的设置: MacBook Pro(视网膜显示屏,13 英寸,2014 年中), 莫哈韦沙漠 10.14.4 和

> version
               _                           
platform       x86_64-apple-darwin13.4.0   
arch           x86_64                      
os             darwin13.4.0                
system         x86_64,darwin13.4.0        
status                                     
major          3                           
minor          6.1                         
year           2019                        
month          07                          
day            05                          
svn rev        76782                       
language       R                           
version.string R version 3.6.1 (2019-07-05)
nickname       Action of the Toes  

编辑:

我做了这里所说的:

Installing R on Mac - Warning messages: Setting LC_CTYPE failed,using "C"

从上面的输出删除了启动错误,但主要问题仍然存在。

> install.packages("dplyr")
also installing the dependencies ‘pillar’,‘lifecycle’,‘rlang’,‘tibble’,‘tidyselect’,‘vctrs’

trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.6.0.tar.gz'
Content type 'application/x-gzip' length 1100197 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.0.tar.gz'
Content type 'application/x-gzip' length 83389 bytes (81 KB)
==================================================
downloaded 81 KB

trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.11.tar.gz'
Content type 'application/x-gzip' length 861727 bytes (841 KB)
==================================================
downloaded 841 KB

trying URL 'https://cran.rstudio.com/src/contrib/tibble_3.1.1.tar.gz'
Content type 'application/x-gzip' length 686855 bytes (670 KB)
==================================================
downloaded 670 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyselect_1.1.1.tar.gz'
Content type 'application/x-gzip' length 92088 bytes (89 KB)
==================================================
downloaded 89 KB

trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.8.tar.gz'
Content type 'application/x-gzip' length 782608 bytes (764 KB)
==================================================
downloaded 764 KB

trying URL 'https://cran.rstudio.com/src/contrib/dplyr_1.0.5.tar.gz'
Content type 'application/x-gzip' length 949019 bytes (926 KB)
==================================================
downloaded 926 KB

* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/tinius/opt/anaconda3/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/tinius/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/tinius/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/tinius/opt/anaconda3=/usr/local/src/conda-prefix  -c capture.c -o capture.o
/bin/sh: x86_64-apple-darwin13.4.0-clang: command not found
make: *** [capture.o] Error 127
ERROR: compilation Failed for package ‘rlang’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/rlang’
* restoring prevIoUs ‘/Users/tinius/opt/anaconda3/lib/R/library/rlang’
Warning in install.packages :
  installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘lifecycle’ ...
** package ‘lifecycle’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i,versionCheck = vI[[i]]) : 
  namespace ‘rlang’ 0.4.5 is being loaded,but >= 0.4.10 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading Failed for package ‘lifecycle’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/lifecycle’
Warning in install.packages :
  installation of package ‘lifecycle’ had non-zero exit status
* installing *source* package ‘vctrs’ ...
** package ‘vctrs’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/tinius/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/tinius/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/tinius/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/tinius/opt/anaconda3=/usr/local/src/conda-prefix  -c altrep-rle.c -o altrep-rle.o
/bin/sh: x86_64-apple-darwin13.4.0-clang: command not found
make: *** [altrep-rle.o] Error 127
ERROR: compilation Failed for package ‘vctrs’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/vctrs’
Warning in install.packages :
  installation of package ‘vctrs’ had non-zero exit status
ERROR: dependencies ‘lifecycle’,‘vctrs’ are not available for package ‘pillar’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/pillar’
Warning in install.packages :
  installation of package ‘pillar’ had non-zero exit status
ERROR: dependency ‘vctrs’ is not available for package ‘tidyselect’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/tidyselect’
Warning in install.packages :
  installation of package ‘tidyselect’ had non-zero exit status
ERROR: dependencies ‘lifecycle’,‘pillar’,‘vctrs’ are not available for package ‘tibble’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/tibble’
Warning in install.packages :
  installation of package ‘tibble’ had non-zero exit status
ERROR: dependencies ‘lifecycle’,‘vctrs’ are not available for package ‘dplyr’
* removing ‘/Users/tinius/opt/anaconda3/lib/R/library/dplyr’
Warning in install.packages :
  installation of package ‘dplyr’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/wp/g4z3sz4d2tvd5sx0s5r796xw0000gn/T/RtmpiqiZDx/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

基本解决

它在 Rstudio 中运行流畅,因为我:

mostly uninstalled anaconda、R 和 Rstudio,从 Mojave 更新到 Big Sur,并重新安装了 R 和 Rstudio

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?