R版本3.6.1(2019-07-05)中的tm软件包安装错误-“脚趾的动作”

时间:2019-11-01 09:43:30

标签: r tm slam

我正在尝试在macOS High Sierra版本10.13.6下运行的Macbook Pro(2011年末)上使用R中的tm软件包。已经安装了tm软件包,但是在加载时,会收到以下错误消息

Error: package or namespace load failed for ‘tm’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘slam’

然后我尝试安装slam并得到了它:


  There is a binary version available but the source
  version is later:
     binary source needs_compilation
slam 0.1-45 0.1-46              TRUE

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

trying URL 'https://cran.rstudio.com/src/contrib/slam_0.1-46.tar.gz'
Content type 'application/x-gzip' length 53515 bytes (52 KB)
==================================================
downloaded 52 KB

* installing *source* package ‘slam’ ...
** package ‘slam’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c apply.c -o apply.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c dll.c -o dll.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c grouped.c -o grouped.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c sparse.c -o sparse.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c util.c -o util.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o slam.so apply.o dll.o grouped.o sparse.o util.o -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [slam.so] Error 1
ERROR: compilation failed for package ‘slam’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/slam’
Warning in install.packages :
  installation of package ‘slam’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/zq/lzsw_rp15sj3wtfvb3r0kksc0000gn/T/RtmpX95gez/downloaded_packages’```
Can anyone please help me fix this?
Thanks!

1 个答案:

答案 0 :(得分:0)

我今天遇到了完全相同的问题。我在使用macOS Mojave(10.14.6)的Mac Book Pro上运行R 3.6.1(按您的方式),并且出现了相同的错误消息。

我从这里尝试了一些答案: dependency ‘slam’ is not available when installing TM package

尝试:

install.packages("NLP", dependencies = TRUE)
install.packages("tm", dependencies = TRUE)

...但没有喜悦。

所以我去了这里: https://cran.r-project.org/web/packages/slam/index.html 并将slam_0.1-45.tgz下载到我的“下载”文件夹中 然后使用以下命令直接从那里安装它:

install.packages("~/Downloads/slam_0.1-45.tgz", repos = NULL, type = .Platform$pkgType)

现在似乎可以很好地安装tm软件包了。