我已经是 R 用户好几年了,今天我打开一个新的 R 项目,但 tidyverse 无法安装。
install.packages("tidyverse")
错误信息是:
Error : install of package 'processx' failed [error code 1]
In addition: Warning message:
1: Dans system2(R(), args, stdout = TRUE, stderr = TRUE) :
l'exécution de la commande ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CC 2>&1' renvoie un statut 1
2: Dans if (eval(cond, envir = environment(dot))) return(eval(expr, envir = environment(dot))) :
la condition a une longueur > 1 et seul le premier élément est utilisé
3: Dans if (eval(cond, envir = environment(dot))) return(eval(expr, envir = environment(dot))) :
la condition a une longueur > 1 et seul le premier élément est utilisé
Traceback (most recent calls last):
14: sourceWithProgress(script = "/var/folders/yw/_p67kkw161v0mh0cd92qcbhw0000gn/T/8163-6b53-10ca-cf6c",
encoding = "UTF-8", con = stdout(), importRdata = NULL, exportRdata = NULL)
13: eval(statements[[idx]], envir = sourceEnv)
12: eval(statements[[idx]], envir = sourceEnv)
11: renv::install("reprex")
10: renv_install_impl(records)
9: renv_install_staged(records)
8: renv_install_default(records)
7: handler(package, renv_install_package(record))
6: renv_install_package(record)
5: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
vwritef("\tFAILED")
writef(e$output)
})
4: renv_install_package_impl(record)
3: r_cmd_install(package, path)
2: r_exec_error(package, output, "install", status)
1: stop(error)
Exécution arrêtée
由于错误似乎与“processx”有关,因此我也尝试下载此软件包,正如此处建议的那样:
install.packages("processx")
但是发生了同样的错误:
Error : install of package 'processx' failed [error code 1]
In addition: Warning message:
1: Dans system2(R(), args, stdout = TRUE, stderr = TRUE) :
l'exécution de la commande ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CC 2>&1' renvoie un statut 1
2: Dans if (eval(cond, envir = environment(dot))) return(eval(expr, envir = environment(dot))) :
la condition a une longueur > 1 et seul le premier élément est utilisé
3: Dans if (eval(cond, envir = environment(dot))) return(eval(expr, envir = environment(dot))) :
la condition a une longueur > 1 et seul le premier élément est utilisé
关于其他套餐:
它可能与我的问题无关,但昨天,我上传了:
我一直在寻找一些解决方案,所以感谢您的帮助,如果可以的话!
问候
维吉尔
感谢您的所有回复。
@Kevin Ushey,版本是“renv_0.14.0”。你的建议,首先是
xcode-select --install
,然后是utils::install.packages("tidyverse")
,效果都很完美……尽管我不明白与“renv”的链接。
所以@Ben Bolker,如你所见,问题解决了:
find("install.packages")
[1] "renv:shims" "package:utils"
然后:
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] MASS_7.3-54 DBI_1.1.2 odbc_1.3.3 callr_3.7.0 processx_3.6.0 forcats_0.5.1
[7] stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7
[13] ggplot2_3.3.6 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] tidyselect_1.1.2 haven_2.5.0 colorspace_2.0-3 vctrs_0.4.1 generics_0.1.2
[6] blob_1.2.3 utf8_1.2.2 rlang_1.0.2 pillar_1.7.0 glue_1.6.2
[11] withr_2.5.0 bit64_4.0.5 dbplyr_2.2.0 modelr_0.1.8 readxl_1.4.0
[16] lifecycle_1.0.1 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_1.0.2
[21] tzdb_0.3.0 ps_1.7.0 fansi_1.0.3 broom_0.8.0 Rcpp_1.0.8.3
[26] renv_0.14.0 scales_1.2.0 backports_1.4.1 jsonlite_1.8.0 fs_1.5.2
[31] bit_4.0.4 hms_1.1.1 stringi_1.7.6 grid_4.1.0 cli_3.3.0
[36] tools_4.1.0 magrittr_2.0.3 crayon_1.5.1 pkgconfig_2.0.3 ellipsis_0.3.2
[41] xml2_1.3.3 reprex_2.0.1 lubridate_1.8.0 assertthat_0.2.1 httr_1.4.3
[46] rstudioapi_0.13 R6_2.5.1 compiler_4.1.0
你摇滚!
> install.packages("tidyverse", dependencies = TRUE)
Installing package into ‘/usr/local/lib/R/4.3/site-library’
(as ‘lib’ is unspecified)
also installing the dependency ‘ragg’
trying URL 'https://cran.rstudio.com/src/contrib/ragg_1.2.7.tar.gz'
Content type 'application/x-gzip' length 425500 bytes (415 KB)
==================================================
downloaded 415 KB
trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_2.0.0.tar.gz'
Content type 'application/x-gzip' length 704618 bytes (688 KB)
==================================================
downloaded 688 KB
<<<* installing *source* package ‘ragg’ ...
<<<** package ‘ragg’ successfully unpacked and MD5 sums checked
<<<** using staged installation
Package libtiff-4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtiff-4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtiff-4' found
Package libtiff-4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtiff-4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtiff-4' found
Homebrew 4.2.1
Using PKG_CFLAGS=-I/usr/local/include -I/usr/local/include/freetype2
Using PKG_LIBS=-L/usr/local/lib -lfreetype -lpng16 -ltiff -lz -ljpeg -lbz2
-----------------------------[ ANTICONF ]-------------------------------
Configuration failed to find one of --static freetype2 libpng libtiff-4 libjpeg. Try installing:
deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
rpm: freetype-devel libpng-devel libtiff-devel libjpeg-devel (Fedora, CentOS, RHEL)
csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
If --static freetype2 libpng libtiff-4 libjpeg is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a --static freetype2 libpng libtiff-4 libjpeg.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:3:10: fatal error: 'tiffio.h' file not found
#include <tiffio.h>
^~~~~~~~~~
1 error generated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘ragg’
removing ‘/usr/local/lib/R/4.3/site-library/ragg’
Warning in install.packages :
installation of package ‘ragg’ had non-zero exit status
ERROR: dependency ‘ragg’ is not available for package ‘tidyverse’
removing ‘/usr/local/lib/R/4.3/site-library/tidyverse’
Warning in install.packages :
installation of package ‘tidyverse’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/sy/2wftyh396f36nkzsls0g4_6r0000gn/T/Rtmpd8NLOm/downloaded_packages’
> library(textshaping)
> library(tidyverse)
Error in library(tidyverse) : there is no package called ‘tidyverse’
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Above error was generated while working on MacOs Catalina version 10.15.7
I <<<<brew install textshaping>>>> and I <<<<brew install libtiff>>>> . There is no libtiff-4 available for brew as suggested by the error message. It is not possible at least in Dec2023 to <<<<brew install tidyverse>>>.
So, if you are on an older MacOs versions and struggling installing tidyverse the above may be a solution to achieve this
library(tidyverse)
── Attaching core tidyverse packages