More than 5 years have passed since last update.
OSXでRのパッケージtidyverseのインストールに詰まった
4
Last updated at Posted at 2018-08-24
AdventCalendar 13日目!
人手足りないけどだんないよ精神でいくよ!!!
概要
MacでR言語に入門する際に便利パッケージであるtidyverseのインストールに詰まったので対処法
環境
OS
ProductName: Mac OS X
ProductVersion: 10.13.6
XCode
Xcode 9.3
Build version 9E145
R
Rversion3.5.1(2018-07-02)--"Feather Spray"Copyright(C)2018TheRFoundationforStatisticalComputingPlatform:x86_64-apple-darwin17.6.0(64-bit)エラーコード
肝心のエラーコード
>install.packages("tidyverse")Installingpackageinto‘/usr/local/lib/R/3.5/site-library’(as‘lib’isunspecified)alsoinstallingthedependencies‘rvest’,‘xml2’URL'https://cran.rstudio.com/src/contrib/rvest_0.3.2.tar.gz'を試していますContenttype'application/x-gzip'length1597137bytes(1.5MB)==================================================downloaded1.5MBURL'https://cran.rstudio.com/src/contrib/xml2_1.2.0.tar.gz'を試していますContenttype'application/x-gzip'length251614bytes(245KB)==================================================downloaded245KBURL'https://cran.rstudio.com/src/contrib/tidyverse_1.2.1.tar.gz'を試していますContenttype'application/x-gzip'length61647bytes(60KB)==================================================downloaded60KB*installing*source*package‘xml2’...**パッケージ‘xml2’の解凍およびMD5サムの検証に成功しましたFoundpkg-configcflagsandlibs!UsingPKG_CFLAGS=-I/usr/include/libxml2UsingPKG_LIBS=-L/usr/lib-lxml2-lz-lpthread-licucore-lm-------------------------ANTICONFERROR---------------------------Configurationfailedbecauselibxml-2.0wasnotfound.Tryinstalling:*deb:libxml2-dev(Debian,Ubuntu,etc)*rpm:libxml2-devel(Fedora,CentOS,RHEL)*csw:libxml2_dev(Solaris)Iflibxml-2.0isalreadyinstalled,checkthat'pkg-config'isinyourPATHandPKG_CONFIG_PATHcontainsalibxml-2.0.pcfile.Ifpkg-configisunavailableyoucansetINCLUDE_DIRandLIB_DIRmanuallyvia:RCMDINSTALL--configure-vars='INCLUDE_DIR=... LIB_DIR=...'--------------------------------------------------------------------ERROR:configurationfailedforpackage‘xml2’*removing‘/usr/local/lib/R/3.5/site-library/xml2’Warningininstall.packages:installationofpackage‘xml2’hadnon-zeroexitstatusERROR:dependency‘xml2’isnotavailableforpackage‘rvest’*removing‘/usr/local/lib/R/3.5/site-library/rvest’Warningininstall.packages:installationofpackage‘rvest’hadnon-zeroexitstatusERROR:dependencies‘rvest’,‘xml2’arenotavailableforpackage‘tidyverse’*removing‘/usr/local/lib/R/3.5/site-library/tidyverse’Warningininstall.packages:installationofpackage‘tidyverse’hadnon-zeroexitstatusThedownloadedsourcepackagesarein‘/private/var/folders/mf/h8zpddh14778rlv254chg2000000gs/T/RtmpO6u1wZ/downloaded_packages’対処1
_ANTICONF ERROR_で「libxml2が入ってないよ」的なエラーが出たのでとりあえずインストール
$ brew install lib2xml
再実行するが、同じエラーが出る
何故???
対処2
調べていると、どうもXCode絡みのよう
-
tidyverse - Package installation in R fail on MacOS - Stack Overflow
- このサイトのOlivierさんが載せているコマンドを実行する
$ xcode-select --install
入った!!!
>library(tidyverse)─Attachingpackages──────────────tidyverse1.2.1─✔ggplot23.0.0✔purrr0.2.5✔tibble1.4.2✔dplyr0.7.6✔tidyr0.8.1✔stringr1.3.1✔readr1.1.1✔forcats0.3.0─Conflicts────────────────tidyverse_conflicts()─✖dplyr::filter()masksstats::filter()✖dplyr::lag()masksstats::lag()下の_Conflicts_に関してはデフォルトっぽいのでそのままでOK
まとめ
そもそもXCodeのコマンドラインツールが入ってなかった
学習始めの環境構築で詰まるとモチベーションをグッと持っていかれる、、、
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
