RStudioのtidyverseパッケージインストールでつまづく...
久々にRとRstudioをインストールし、分析環境を整えようとしたところ、
パッケージインストールでつまづいたので、それをまとめます。
- そもそもの目的
- tidyverseについて
- 詰まった場所①:namespace
- 詰まった場所②:license_is_foss
- 詰まった場所③:xcode/ios license requires admin privileges
- まとめ
そもそもの目的
株式売買の分析するためにRを使おうと画策、
そして、折角なのでRStudioを使おう、
折角なので、tidyverseを使おう。
※わたしの技術レベル
約10年前に、R consoleで大学時代にデータ処理をかじった程度...
たまにRコマンダーも使っていた...ほぼ初心者同然。
今のPCがiMac(Mojave 10.14.6)なので、これが今回悪さをした側面もあるかも。
tidyverseについて
Rについてそこまでお勉強しなくともグラフを作れたりデータを操れる便利パッケージ。
詳しくは下記サイトをご参照ください。
bcl.sci.yamaguchi-u.ac.jp
Base Rに慣れ親しんだ人なら、下記サイトの方が親しみが湧くかもしれません。
qiita.com
詰まった場所①:namespace
Rパッケージの良い所は関連パッケージも引っ張ってきてる所。
しかし、そもそもインストールコマンドが通らない。
install.packages("tidyverse")
下記のようなエラーメッセージが発生している。
package or namespace load failed for ‘tidyverse’ in loadnamespace
namespaceがだめなのかscaleなどがだめなのか、迷った末、
下記サイトを参考にscaleとggplot2を更新。
その結果、エラーメッセージが変わり(上記対応だけでは解消しなかった...)
詰まった場所②:license_is_foss
下記エラーメッセージが発生
package libpath version priority depends imports linkingto suggests enhances license license_is_foss license_restricts_use os_type archs md5sum needscompilation built
Googleで調べると同様事象は発生しているものの、原因は謎のようです。 www.javaer101.com
上記記事ではオフラインインストールで対処したということで、
私も下記コマンドを実行してみる。
install.packages("tidyr", dependencies=TRUE) install.packages("tidyverse", dependencies=TRUE)
すると、なぜか解決し、別のエラーが発生。
詰まった場所③:xcode/ios license requires admin privileges
下記エラーが発生
agreeing to the xcode/ios license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
Googleで対処法を調べてみると、XcodeでGitコマンドを打鍵する方法で解決するよう。
しかし、ここで私のPC側に下記2点の課題が発生する。
2015年にインストールしたXcodeが起動できない Xcodeを再インストールしようとしたところ、OSバージョンが古くAppStoreからダウンロードできない
これを機にOSアップデートと、Xcodeの再インストールをするが、 terminalにて"git status"コマンドを打って、OKボタンを押すと解消されました。
下記サイトと同じ流れですね。 tracpath.com
上記対応後に再度、installコマンドを実施します。
install.packages("tidyverse", dependencies=TRUE)
下記のようなログが出ながら、installコマンドがようやく通りました...
> install.packages("tidyverse", dependencies=TRUE) also installing the dependency ‘tidyr’ There is a binary version available but the source version is later: binary source needs_compilation tidyr 1.1.2 1.1.3 TRUE Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/tidyverse_1.3.0.tgz' を試しています Content type 'application/x-gzip' length 433049 bytes (422 KB) ================================================== downloaded 422 KB The downloaded binary packages are in /var/folders/hh/gy8r77r91pv3d7vrrp33h5580000gp/T//Rtmpc3iHcu/downloaded_packages installing the source package ‘tidyr’ URL 'https://cran.rstudio.com/src/contrib/tidyr_1.1.3.tar.gz' を試しています Content type 'application/x-gzip' length 707909 bytes (691 KB) ================================================== downloaded 691 KB * installing *source* package ‘tidyr’ ... ** パッケージ ‘tidyr’ の解凍および MD5 サムの検証に成功しました ** using staged installation ** libs clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cpp11/include' -I/usr/local/include -fPIC -Wall -g -O2 -c cpp11.cpp -o cpp11.o clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cpp11/include' -I/usr/local/include -fPIC -Wall -g -O2 -c fill.cpp -o fill.o clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cpp11/include' -I/usr/local/include -fPIC -Wall -g -O2 -c melt.cpp -o melt.o clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cpp11/include' -I/usr/local/include -fPIC -Wall -g -O2 -c simplifyPieces.cpp -o simplifyPieces.o clang++ -mmacosx-version-min=10.13 -std=gnu++11 -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 tidyr.so cpp11.o fill.o melt.o simplifyPieces.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-tidyr/00new/tidyr/libs ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices *** copying figures ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (tidyr) The downloaded source packages are in ‘/private/var/folders/hh/gy8r77r91pv3d7vrrp33h5580000gp/T/Rtmpc3iHcu/downloaded_packages’
まとめ
上記対応を実施した結果、無事にtidyverseがインストールされ、
libraryコマンドでもリターンが返ってきました。
> library(tidyverse) ─ Attaching packages ────────────────────────── tidyverse 1.3.0 ─ ✓ ggplot2 3.3.3 ✓ readr 1.4.0 ✓ tibble 3.1.0 ✓ purrr 0.3.4 ✓ tidyr 1.1.3 ✓ forcats 0.5.1 ─ Conflicts ─────────────────────────── tidyverse_conflicts() ─ x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() > install.packages("luzlogr") URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/luzlogr_0.2.0.tgz' を試しています Content type 'application/x-gzip' length 38942 bytes (38 KB) ================================================== downloaded 38 KB
環境構築だけで、結構躓くとつらいものがあります...
ブログ村ランキングに参加しています。
良かったら、うちのアイドル、そらちゃんの足をクリックしてみてください。