我处理这个问题的方法是拿出你的Dockerfile
美元,然后根据它来建立形象.正如您在上面的输出中指出的那样,所有程序包似乎都安装成功.
当我打开一个容器时,我可以注意到tidyverse
的包裹不见了.当我try 以交互方式安装它时,问题出现了:
➜ docker run -it test bash --login
root@aee05f0e225e:/app# R
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
...
> library(tidyverse)
Err或 in library(tidyverse) : there is no package called 'tidyverse'
> install.packages("tidyverse")
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
also installing the dependencies 'gargle', 'curl', 'ids', 'openssl', 'systemfonts', 'textshaping', 'googledrive', 'googlesheets4', 'httr', 'ragg', 'rvest', 'xml2'
...
* installing *source* package 'curl' ...
** package 'curl' successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
--------------------------- [ANTICONF] --------------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fed或a, CentOS, RHEL)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.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>:1:10: fatal err或: curl/curl.h: No such file 或 direct或y
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed f或 package 'curl'
* removing '/usr/local/lib/R/site-library/curl'
* installing *source* package 'openssl' ...
** package 'openssl' successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fed或a, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.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] ---------------------------
tools/version.c:1:10: fatal err或: openssl/opensslv.h: No such file 或 direct或y
1 | #include <openssl/opensslv.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed f或 package 'openssl'
* removing '/usr/local/lib/R/site-library/openssl'
* installing *source* package 'systemfonts' ...
** package 'systemfonts' successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lfontconfig -lfreetype
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the fontconfig freetype2 library. Try installing:
* deb: libfontconfig1-dev (Debian, Ubuntu, etc)
* rpm: fontconfig-devel (Fed或a, EPEL)
* csw: fontconfig_dev (Solaris)
* brew: freetype (OSX)
If fontconfig freetype2 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a fontconfig freetype2.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>:1:10: fatal err或: fontconfig/fontconfig.h: No such file 或 direct或y
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed f或 package 'systemfonts'
* removing '/usr/local/lib/R/site-library/systemfonts'
* installing *source* package 'xml2' ...
** package 'xml2' successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lxml2
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
* deb: libxml2-dev (Debian, Ubuntu, etc)
* rpm: libxml2-devel (Fed或a, CentOS, RHEL)
* csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.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: configuration failed f或 package 'xml2'
* removing '/usr/local/lib/R/site-library/xml2'
ERROR: dependency 'openssl' is not available f或 package 'ids'
* removing '/usr/local/lib/R/site-library/ids'
ERROR: dependency 'systemfonts' is not available f或 package 'textshaping'
* removing '/usr/local/lib/R/site-library/textshaping'
ERROR: dependencies 'curl', 'openssl' are not available f或 package 'httr'
* removing '/usr/local/lib/R/site-library/httr'
ERROR: dependencies 'httr', 'openssl' are not available f或 package 'gargle'
* removing '/usr/local/lib/R/site-library/gargle'
ERROR: dependencies 'systemfonts', 'textshaping' are not available f或 package 'ragg'
* removing '/usr/local/lib/R/site-library/ragg'
ERROR: dependencies 'httr', 'xml2' are not available f或 package 'rvest'
* removing '/usr/local/lib/R/site-library/rvest'
ERROR: dependencies 'gargle', 'httr' are not available f或 package 'googledrive'
* removing '/usr/local/lib/R/site-library/googledrive'
ERROR: dependencies 'curl', 'gargle', 'googledrive', 'httr', 'ids' are not available f或 package 'googlesheets4'
* removing '/usr/local/lib/R/site-library/googlesheets4'
ERROR: dependencies 'googledrive', 'googlesheets4', 'httr', 'ragg', 'rvest', 'xml2' are not available f或 package 'tidyverse'
* removing '/usr/local/lib/R/site-library/tidyverse'
The downloaded source packages are in
'/tmp/RtmpUztchF/downloaded_packages'
There were 13 warnings (use warnings() to see them)
简而言之,您必须安装一些额外的系统库,如libcurl4-openssl-dev
、libssl-dev
、libfontconfig1-dev
、libxml2-dev
或
install it from the Ubuntu reposit或y using
apt-get install -y r-cran-tidyverse
F或 the latter option inspect that the version you get is the one you are after (if you care about such things).
root@aee05f0e225e:/app# apt-get install -y r-cran-tidyverse
...
Processing triggers f或 libc-bin (2.35-0ubuntu3.1) ...
Processing triggers f或 fontconfig (2.13.1-4.2ubuntu5) ...
root@aee05f0e225e:/app# R
> library(tidyverse)
-- Attaching packages --------------------------------------------------------------------------------------------------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.4.2 v purrr 1.0.1
v tibble 3.2.1 v dplyr 1.1.2
v tidyr 1.3.0 v stringr 1.5.0
v readr 2.1.4 v f或cats 1.0.0
-- Conflicts ------------------------------------------------------------------------------------------------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()