首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在MAC上加载包

在MAC上加载包
EN

Stack Overflow用户
提问于 2020-09-22 23:49:31
回答 1查看 385关注 0票数 0

到目前为止,在我的PC上训练neuralnetwork()已经拖了24个多小时,但这是另一个问题。在运行时,我(今天)在我的MAC上下载了R studio,以便同时运行其他代码;但是,我无法设置它。我在我的电脑上使用的相同的包不能在这个MAC上加载。这就是以下邮包的情况:

代码语言:javascript
运行
复制
library(mice)
library(dlookr)
library(rgl)

让我们放大dlookr

代码语言:javascript
运行
复制
> library(dlookr)
Loading required package: mice
Error: package or namespace load failed for ‘mice’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘broom’
Error: package ‘mice’ could not be loaded

看起来如果我能解析mice,我就会得到1取2的结果。这就是它说的:

代码语言:javascript
运行
复制
    > library(mice)
Error: package or namespace load failed for ‘mice’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘broom’

在我的PC上,这在没有broom的情况下也能正常工作,但不管怎样,我还是跟着玩吧。

代码语言:javascript
运行
复制
> install.packages("broom")

  There is a binary version available but the source version
  is later:
      binary source needs_compilation
broom  0.5.5  0.7.0             FALSE

installing the source package ‘broom’

trying URL 'https://cran.rstudio.com/src/contrib/broom_0.7.0.tar.gz'
Content type 'application/x-gzip' length 604195 bytes (590 KB)
==================================================
downloaded 590 KB

* installing *source* package ‘broom’ ...
** package ‘broom’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error : object ‘pivot_longer’ is not exported by 'namespace:tidyr'
ERROR: lazy loading failed for package ‘broom’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/broom’
Warning in install.packages :
  installation of package ‘broom’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/yl/tb3dwr4x5gd79c_lbr_krp9h0000gn/T/RtmpK9gAxy/downloaded_packages’

然后..。

代码语言:javascript
运行
复制
> library(broom)
Error in library(broom) : there is no package called ‘broom’

如果我可以安装和加载broom,我是否可以加载micedlookr?更重要的是,为什么我不能安装和加载broom

在安装和加载我使用的其他一些包时,我注意到其中一些类似于broom的包具有可用的二进制和源代码版本。然而,与broom不同的是,他们给了我一个选择,让我选择安装哪一个。在这些情况下,如果我选择安装源版本,这些包也不会加载。我不得不回去安装这些软件包的替代版本,这是我在PC上从未担心过的事情。我不知道这两个版本之间的技术差异是什么,但会不会是broom默认安装了自己的无效版本?如果是这样,我如何选择并安装其他版本?

看起来rgl是另一个包含源代码和二进制版本的库。rgl允许我选择安装哪一个;但是,这两个选项都不起作用。Heren正在安装R,但无法加载二进制版本:

代码语言:javascript
运行
复制
> install.packages("rgl")

  There is a binary version available but the source version
  is later:
      binary   source needs_compilation
rgl 0.100.50 0.100.54              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/rgl_0.100.50.tgz'
Content type 'application/x-gzip' length 4709273 bytes (4.5 MB)
==================================================
downloaded 4.5 MB


The downloaded binary packages are in
    /var/folders/yl/tb3dwr4x5gd79c_lbr_krp9h0000gn/T//RtmpK9gAxy/downloaded_packages
> library(rgl)
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl/libs/rgl.so
  Reason: image not found
Error: package or namespace load failed for ‘rgl’:
 .onLoad failed in loadNamespace() for 'rgl', details:
  call: NULL
  error:    Loading rgl's DLL failed. 
    On MacOS, rgl depends on XQuartz, which you can download from xquartz.org.

在这里,它正在安装,但无法加载源版本:

代码语言:javascript
运行
复制
> install.packages("rgl")

  There is a binary version available but the source version
  is later:
      binary   source needs_compilation
rgl 0.100.50 0.100.54              TRUE

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

trying URL 'https://cran.rstudio.com/src/contrib/rgl_0.100.54.tar.gz'
Content type 'application/x-gzip' length 2952743 bytes (2.8 MB)
==================================================
downloaded 2.8 MB

* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for gcc... (cached) clang
checking whether we are using the GNU C compiler... (cached) yes
checking whether clang accepts -g... (cached) yes
checking for clang option to accept ISO C89... (cached) none needed
checking for libpng-config... no
checking libpng... checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
checking for png_read_update_info in -lpng... no
configure: libpng header and lib found
configure: using libpng dynamic linkage
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl’
Warning in install.packages :
  installation of package ‘rgl’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/yl/tb3dwr4x5gd79c_lbr_krp9h0000gn/T/RtmpK9gAxy/downloaded_packages’
> library(rgl)
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgl/libs/rgl.so
  Reason: image not found
Error: package or namespace load failed for ‘rgl’:
 .onLoad failed in loadNamespace() for 'rgl', details:
  call: NULL
  error:    Loading rgl's DLL failed. 
    On MacOS, rgl depends on XQuartz, which you can download from xquartz.org.

这里发生了什么事?这是否与加载broommicedlookr失败有关?谢谢你的帮忙!

编辑

我重新下载了R,现在mice加载正常;但是,dlookrrgl仍然不能。

代码语言:javascript
运行
复制
> library(dlookr)
Error: package or namespace load failed for ‘dlookr’:
 .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: X11 library is missing: install XQuartz from xquartz.macosforge.org

代码语言:javascript
运行
复制
> library(rgl)
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rgl/libs/rgl.so
  Reason: image not found
Error: package or namespace load failed for ‘rgl’:
 .onLoad failed in loadNamespace() for 'rgl', details:
  call: NULL
  error:    Loading rgl's DLL failed. 
    On MacOS, rgl depends on XQuartz, which you can download from xquartz.org.

我试着下载XQuartz,但是:

代码语言:javascript
运行
复制
> install.packages("XQuartz")
Warning in install.packages :
  package ‘XQuartz’ is not available (for R version 4.0.2)

我需要回去安装一个旧版本的R才能正常工作吗??

EN

回答 1

Stack Overflow用户

发布于 2020-09-23 00:54:29

看起来我需要从xquartz.org下载并安装XQuartz,才能让其中的一些包在MAC上运行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64013306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档