devtools::load_all hanging

I've been working on a local package -my first, so I'm not so knowledgeable.

I recently updated my mac's OS to Mojave and when reloading my package in a fresh Rstudio session via devtools::load_all("."), Rstudio hangs indefinitely and CPU usage spikes to 100%.

The package was built from scratch using Rstudio's package tools and devtools from the beginning, following the R Packages book.

Googling the error suggests potential problems with either the working directory or a missing DESCRIPTION file, but both of those seem fine; ie getwd() returns the expected on-disk package directory and the DESC file exists, I can open it, looks right, etc; and I've never edited it by hand.

Unfortunately I can't give a very helpful reprex but below is the output of a few simple things along with session info.

Any guidance would be much appreciated.

getwd()
#> [1] "/Users/cawthm/my_tools"

devtools::load_all(".")
#> Error: Could not find package root.

devtools::check()
#> Error: Could not find package root.

Created on 2018-11-06 by the reprex package (v0.2.1)

Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.5.1 (2018-07-02)
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/Chicago             
#>  date     2018-11-06
#> Packages -----------------------------------------------------------------
#>  package   * version date       source         
#>  backports   1.1.2   2017-12-13 CRAN (R 3.5.0) 
#>  base      * 3.5.1   2018-07-05 local          
#>  compiler    3.5.1   2018-07-05 local          
#>  datasets  * 3.5.1   2018-07-05 local          
#>  devtools    1.13.6  2018-06-27 CRAN (R 3.5.0) 
#>  digest      0.6.15  2018-01-28 CRAN (R 3.5.0) 
#>  evaluate    0.10.1  2017-06-24 CRAN (R 3.5.0) 
#>  graphics  * 3.5.1   2018-07-05 local          
#>  grDevices * 3.5.1   2018-07-05 local          
#>  htmltools   0.3.6   2017-04-28 CRAN (R 3.5.0) 
#>  knitr       1.20    2018-02-20 CRAN (R 3.5.0) 
#>  magrittr    1.5     2014-11-22 CRAN (R 3.5.0) 
#>  memoise     1.1.0   2017-04-21 CRAN (R 3.5.0) 
#>  methods   * 3.5.1   2018-07-05 local          
#>  Rcpp        0.12.19 2018-10-01 cran (@0.12.19)
#>  rmarkdown   1.9     2018-03-01 CRAN (R 3.5.0) 
#>  rprojroot   1.3-2   2018-01-03 CRAN (R 3.5.0) 
#>  stats     * 3.5.1   2018-07-05 local          
#>  stringi     1.2.2   2018-05-02 CRAN (R 3.5.0) 
#>  stringr     1.3.1   2018-05-10 CRAN (R 3.5.0) 
#>  tools       3.5.1   2018-07-05 local          
#>  utils     * 3.5.1   2018-07-05 local          
#>  withr       2.1.2   2018-03-15 CRAN (R 3.5.0) 
#>  yaml        2.1.19  2018-05-01 CRAN (R 3.5.0)

Here's what I did:

1- updated devtools from 1.3 to the current CRAN release: 2.0.1

2- commented out all my functions which were spread over three files

3- Ran devtools::reload_all(). this worked.

4- I then gradually uncommented code/ re-ran reload_all() until I found a culprit: a call to readr::read_csv which was trying to read an enormous file of json.

It's unclear to me how to simultaneously sandbox (ie play around with code in temp.R script files) and develop functions as I iteratively work on and test my package, but in this case, this solved my problem

(PS- the 'could not find package root' error from the unhelpful code I provided is, I think, an artifact of how reprex::reprex works, not the actual issue in this instance.

2 Likes

That sounds like a good question for a new topic :grin: (since it's more of a discussion question, you might want to read this first: FAQ: Tips for Introducing Non-Programming-Problem Discussions)

I appreciate that suggestion.

For the record, I love this site, and I've noticed all the work that you (both plural -other sustainers- but you in particular) do to clean up questions, help send them in the right direction, add category tags, etc, in order to make sure everyone gets some response.

This work is super important, and super appreciated, so thanks.

For now, I'll continue working my way through Hadley's book before opening a discussion topic on this point.

1 Like

Aw, thanks! :blush: And I'll pay it back by saying that I loved how your self-answer above laid out the process you took to debug your own problem — really nice, and likely to be helpful to others even if their problem isn't quite the same as yours. Thanks for helping to make this community awesome :smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.