備忘ログ

チラシの裏的備忘録&メモ

Rでパッケージのアップデートがうまく行かなかったときに対処したこと

{callr}のバージョンが3.4.2から3.4.3にアップデートされたとのことで、特にアップデートしてやりたいことがあるわけじゃないけどマイナーバージョンアップなのでサクッとアップデートしようと思ったらサクッと行けなかったので対処法のメモ。

多分今回は{callr}だったが、他のパッケージでも同様にアップデートに必要とされるパッケージがインストールされていてもうまくロードできないと起こることがあるかもしれない。

もちろんインストールされていなければエラーメッセージに従いインストールしていくのみ。

install.packages("callr")
Installing package into ‘:/document/R/win-library/3.6(as ‘lib’ is unspecified)

  There is a binary version available but the
  source version is later:
      binary source needs_compilation
callr  3.4.2  3.4.3             FALSE

installing the source package ‘callr’

 URL 'https://cran.rstudio.com/src/contrib/callr_3.4.3.tar.gz' を試しています 
Content type 'application/x-gzip' length 85802 bytes (83 KB)
downloaded 83 KB

* installing *source* package 'callr' ...
**  パッケージ 'callr' の解凍および MD5 サムの検証に成功しました 
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'callr'
    finding HTML links ...  完了 
    callr                                   html  
    convert_and_check_my_args               html  
    default_repos                           html  
    get_result                              html  
    new_callr_error                         html  
    r                                       html  
Rd warning: C:/Users/HOGE/AppData/Local/Temp/Rtmp0OJf6u/R.INSTALL1c285a067b9b/callr/man/r.Rd:180: file link 'dump.frames' in package 'utils' does not exist and so has been treated as a topic
    r_bg                                    html  
    r_copycat                               html  
    r_process                               html  
    r_process_options                       html  
    r_session                               html  
    r_session_debug                         html  
    r_session_options                       html  
    r_vanilla                               html  
    rcmd                                    html  
    rcmd_bg                                 html  
    rcmd_copycat                            html  
    rcmd_process                            html  
    rcmd_process_options                    html  
    rcmd_safe                               html  
    reexports                               html  
    rscript                                 html  
    rscript_process                         html  
    rscript_process_options                 html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'callr':
 .onLoad failed in loadNamespace() for 'processx', details:
  call: library.dynam(lib, package, package.lib)
  error: DLL 'ps' not found: maybe not installed for this architecture?
 エラー:  ロードに失敗しました 
 実行が停止されました 
*** arch - x64
ERROR: loading failed for 'i386'
* removing ':/document/R/win-library/3.6/callr'
* restoring previous ':/document/R/win-library/3.6/callr'
Warning in install.packages :
  installation of package ‘callr’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\HOGE\AppData\Local\Temp\RtmpyCUUTw\downloaded_packages’

ということで{ps}はインストール済みなのだが……

読み込んでないと失敗するのかと思いlibrary(ps)で読み込んでみたけど同じエラーが出る。

エラーメッセージで{ps}見つけられないよ? インストールしてる? と聞いてくるので、インストールし直してみる。

install.packages("ps")
Installing package into ‘:/document/R/win-library/3.6(as ‘lib’ is unspecified)
 URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/ps_1.3.2.zip' を試しています 
Content type 'application/zip' length 311545 bytes (304 KB)
downloaded 304 KB

package ‘ps’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\HOGE\AppData\Local\Temp\RtmpyCUUTw\downloaded_packages

install.packages("callr")
Installing package into ‘:/document/R/win-library/3.6(as ‘lib’ is unspecified)

  There is a binary version available but the
  source version is later:
      binary source needs_compilation
callr  3.4.2  3.4.3             FALSE

installing the source package ‘callr’

 URL 'https://cran.rstudio.com/src/contrib/callr_3.4.3.tar.gz' を試しています 
Content type 'application/x-gzip' length 85802 bytes (83 KB)
downloaded 83 KB

* installing *source* package 'callr' ...
**  パッケージ 'callr' の解凍および MD5 サムの検証に成功しました 
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'callr'
    finding HTML links ...  完了 
    callr                                   html  
    convert_and_check_my_args               html  
    default_repos                           html  
    get_result                              html  
    new_callr_error                         html  
    r                                       html  
Rd warning: C:/Users/kobayashi/AppData/Local/Temp/RtmpIPEYrC/R.INSTALL2a88799b7ecc/callr/man/r.Rd:180: file link 'dump.frames' in package 'utils' does not exist and so has been treated as a topic
    r_bg                                    html  
    r_copycat                               html  
    r_process                               html  
    r_process_options                       html  
    r_session                               html  
    r_session_debug                         html  
    r_session_options                       html  
    r_vanilla                               html  
    rcmd                                    html  
    rcmd_bg                                 html  
    rcmd_copycat                            html  
    rcmd_process                            html  
    rcmd_process_options                    html  
    rcmd_safe                               html  
    reexports                               html  
    rscript                                 html  
    rscript_process                         html  
    rscript_process_options                 html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (callr)

The downloaded source packages are in
    ‘C:\Users\HOGE
i\AppData\Local\Temp\RtmpyCUUTw\downloaded_packages’

とアップデートに成功した。

うまく{ps}パッケージがロードされていなかったのか?

根本的原因は不明だがとりあえず現象が解決した。