R4EPI / sitrep

Report templates and helper functions for applied epidemiology
https://r4epi.github.io/sitrep/
GNU General Public License v3.0
40 stars 14 forks source link

Issues with installing from github #35

Closed aspina7 closed 5 years ago

aspina7 commented 5 years ago

Walking through installing from github and he got a whole bunch of errors - starting with not being able to update packages. See below.

Probs good to address next week before sending out to epis.

He needed to reinstall the package colorspace and restart the R session and then it worked for colorspace. Then got same error for rlang, repeated above steps and then epireports loaded correctly but templates are still not there.... @dirkschumacher @zkamvar

epireports_loading
zkamvar commented 5 years ago

I suspect these installation errors may be coming from the default setting of R regarding saving and loading of workspaces. This would cause loaded packages to stay loaded even if you start RStudio in a supposedly clean session.

I strongly recommend go to the Global Options of RStudio and de-select "load .RData on startup" and set "Save workspace to .RData on exit" to "Never" as illustrated in this forum post from Hadley:

RStudio global options window showing a setting optimal for reproducibility

aspina7 commented 5 years ago

@pbkeating can you try please? Would this also solve the templates not showing up though @zkamvar?

zkamvar commented 5 years ago

Would this also solve the templates not showing up though @zkamvar?

This is a bit more difficult to diagnose, I'm afraid. How do you mean the templates don't show up? One thing to check is if the installed version is the same as the github version. What happens if you type packageDescription("epireports")$GithubSHA1 in the R console?

zkamvar commented 5 years ago

Also, whose computer was this?

aspina7 commented 5 years ago

The only templates that show up are called "github_document" and "untitled_document" (I think) will need to wait and see what pat comes back with

zkamvar commented 5 years ago

The only templates that show up are called "github_document" and "untitled_document" (I think) will need to wait and see what pat comes back with

That's a bit strange. If rmarkdown is installed on the computer, I think the first two should appear like so:

(see https://bookdown.org/yihui/rmarkdown/document-templates.html)

zkamvar commented 5 years ago

Also, what happens if you use the following:

rmarkdown::draft("outbreak.Rmd", template = "outbreak", package = "epireports")
pbkeating commented 5 years ago

Hi both,

Upon opening R this morning all the options for markdown templates were available i.e mortality survey etc. Maybe it just needed a restart?

@Zhian Kamvar zkamvar@gmail.com you were right, the two templates available previously were github document and package vignette

Thanks, Pat

On Mon, 21 Jan 2019 at 08:33, Zhian N. Kamvar notifications@github.com wrote:

Also, what happens if you use the following:

rmarkdown::draft("outbreak.Rmd", template = "outbreak", package = "epireports")

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/R4EPI/epireports/issues/35#issuecomment-455988255, or mute the thread https://github.com/notifications/unsubscribe-auth/ATTSQ_I46R1r6SyrkZhaYiF1EFbMbWdsks5vFXtZgaJpZM4aIR1y .

pbkeating commented 5 years ago

Ah. Was it your computer, Pat? Did you make the changes in the global options that I mentioned above?

Sent from my iPhone

On Jan 21, 2019, at 19:42, patrick keating patrickbkeating1@gmail.com wrote:

Hi both,

Upon opening R this morning all the options for markdown templates were available i.e mortality survey etc. Maybe it just needed a restart?

@Zhian Kamvar you were right, the two templates available previously were github document and package vignette

Thanks, Pat

On Mon, 21 Jan 2019 at 08:33, Zhian N. Kamvar notifications@github.com wrote: Also, what happens if you use the following:

rmarkdown::draft("outbreak.Rmd", template = "outbreak", package = "epireports") — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

pbkeating commented 5 years ago

Hi Zhian,

I didn't change anything. Just opened R today and everything was there.

Thanks, Pat

On Mon 21 Jan 2019, 11:22 Zhian Kamvar <zkamvar@gmail.com wrote:

Ah. Was it your computer, Pat? Did you make the changes in the global options that I mentioned above?

Sent from my iPhone

On Jan 21, 2019, at 19:42, patrick keating patrickbkeating1@gmail.com wrote:

Hi both,

Upon opening R this morning all the options for markdown templates were available i.e mortality survey etc. Maybe it just needed a restart?

@Zhian Kamvar zkamvar@gmail.com you were right, the two templates available previously were github document and package vignette

Thanks, Pat

On Mon, 21 Jan 2019 at 08:33, Zhian N. Kamvar notifications@github.com wrote:

Also, what happens if you use the following:

rmarkdown::draft("outbreak.Rmd", template = "outbreak", package = "epireports")

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/R4EPI/epireports/issues/35#issuecomment-455988255, or mute the thread https://github.com/notifications/unsubscribe-auth/ATTSQ_I46R1r6SyrkZhaYiF1EFbMbWdsks5vFXtZgaJpZM4aIR1y .

AmmerB commented 5 years ago

@zkamvar @aspina7

Still have issue installing as 'update' > devtools::install_github("R4EPI/sitrep")

Downloading GitHub repo R4EPI/sitrep@master
These packages have more recent versions available.
Which would you like to update?

1:   backports  (1.1.3  -> 1.1.4 ) [CRAN]
2:   data.table (1.12.0 -> 1.12.2) [CRAN]
3:   ggplot2    (3.1.0  -> 3.1.1 ) [CRAN]
4:   rlang      (0.3.2  -> 0.3.4 ) [CRAN]
5:   tinytex    (0.11   -> 0.12  ) [CRAN]
6:   xfun       (0.5    -> 0.6   ) [CRAN]
7:   CRAN packages only
8:   All
9:   None`

Select option 8:

Enter one or more numbers separated by spaces, or an empty line to cancel
1: 8
abind      (NA     -> 1.4-5 ) [CRAN]
backports  (1.1.3  -> 1.1.4 ) [CRAN]
cowplot    (NA     -> 0.9.4 ) [CRAN]
data.table (1.12.0 -> 1.12.2) [CRAN]
generics   (NA     -> 0.0.2 ) [CRAN]
ggplot2    (3.1.0  -> 3.1.1 ) [CRAN]
ggspatial  (NA     -> 1.0.3 ) [CRAN]
huxtable   (NA     -> 4.5.0 ) [CRAN]
lwgeom     (NA     -> 0.1-6 ) [CRAN]
prettymapr (NA     -> 0.2.2 ) [CRAN]
rlang      (0.3.2  -> 0.3.4 ) [CRAN]
rosm       (NA     -> 0.2.4 ) [CRAN]
srvyr      (NA     -> 0.3.4 ) [CRAN]
tinytex    (0.11   -> 0.12  ) [CRAN]
xfun       (0.5    -> 0.6   ) [CRAN]
Installing 15 packages: abind, backports, cowplot, data.table, generics, ggplot2, ggspatial, huxtable, lwgeom, prettymapr, rlang, rosm, srvyr, tinytex, xfun
Installing packages into ‘x:\path’
(as ‘lib’ is unspecified)

Operation halts at following error:

package ‘abind’ successfully unpacked and MD5 sums checked
package ‘backports’ successfully unpacked and MD5 sums checked
Error: (converted from warning) cannot remove prior installation of package ‘backports’

Retry gives following error, with package called backports (same as initial halt), can't find under my packages.


> devtools::install_github("R4EPI/sitrep")
Error: .onLoad failed in loadNamespace() for 'pkgload', details:
  call: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
  error: there is no package called ‘backports’
zkamvar commented 5 years ago

It’s asking if you want to update these packages. This is normal behavior. If you don’t want to update, you can select “None”. We can add this to the wiki if you would like.

Sent from my iPhone

On Apr 13, 2019, at 09:29, Amrish Baidjoe notifications@github.com wrote:

Still have issue installing as 'update' `> devtools::install_github("R4EPI/sitrep") Downloading GitHub repo R4EPI/sitrep@master These packages have more recent versions available. Which would you like to update?

1: backports (1.1.3 -> 1.1.4 ) [CRAN] 2: data.table (1.12.0 -> 1.12.2) [CRAN] 3: ggplot2 (3.1.0 -> 3.1.1 ) [CRAN] 4: rlang (0.3.2 -> 0.3.4 ) [CRAN] 5: tinytex (0.11 -> 0.12 ) [CRAN] 6: xfun (0.5 -> 0.6 ) [CRAN] 7: CRAN packages only 8: All 9: None`

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

zkamvar commented 5 years ago

Also, sorry, only the first part of the message showed up for me. I’ll take a look into this later.

Sent from my iPhone

On Apr 13, 2019, at 09:29, Amrish Baidjoe notifications@github.com wrote:

Still have issue installing as 'update' `> devtools::install_github("R4EPI/sitrep") Downloading GitHub repo R4EPI/sitrep@master These packages have more recent versions available. Which would you like to update?

1: backports (1.1.3 -> 1.1.4 ) [CRAN] 2: data.table (1.12.0 -> 1.12.2) [CRAN] 3: ggplot2 (3.1.0 -> 3.1.1 ) [CRAN] 4: rlang (0.3.2 -> 0.3.4 ) [CRAN] 5: tinytex (0.11 -> 0.12 ) [CRAN] 6: xfun (0.5 -> 0.6 ) [CRAN] 7: CRAN packages only 8: All 9: None`

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

zkamvar commented 5 years ago

You will want to make sure that you are starting from a clean R session as described in the wiki. What might be happening is that you had a package loaded that had backports also loaded.

Sent from my iPhone

On Apr 13, 2019, at 09:46, Zhian Kamvar zkamvar@gmail.com wrote:

Also, sorry, only the first part of the message showed up for me. I’ll take a look into this later.

Sent from my iPhone

On Apr 13, 2019, at 09:29, Amrish Baidjoe notifications@github.com wrote:

Still have issue installing as 'update' `> devtools::install_github("R4EPI/sitrep") Downloading GitHub repo R4EPI/sitrep@master These packages have more recent versions available. Which would you like to update?

1: backports (1.1.3 -> 1.1.4 ) [CRAN] 2: data.table (1.12.0 -> 1.12.2) [CRAN] 3: ggplot2 (3.1.0 -> 3.1.1 ) [CRAN] 4: rlang (0.3.2 -> 0.3.4 ) [CRAN] 5: tinytex (0.11 -> 0.12 ) [CRAN] 6: xfun (0.5 -> 0.6 ) [CRAN] 7: CRAN packages only 8: All 9: None`

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

AmmerB commented 5 years ago

Did restart R session, but didn't make a difference. Based on last error message:

> devtools::install_github("R4EPI/sitrep")
Error: .onLoad failed in loadNamespace() for 'pkgload', details:
  call: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
  error: there is no package called ‘backports’

I tried this: install.packages("backports")

> install.packages("backports")
Installing package into ‘x:/path/’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/backports_1.1.4.zip'
Content type 'application/zip' length 66186 bytes (64 KB)
downloaded 64 KB

Then retried installing 'epireports' using: devtools::install_github("R4EPI/sitrep")

Success, everything including all *.rmd templates are updated now. Not sure if this is a more common issue, but would be great if the final 'epireports' package installer would by default install 'backports', not even sure what it does and of which package it is a codependency, but otherwise it halts the installation.

zkamvar commented 5 years ago

I think I've found the problem, which is an understandable mistake. You used devtools::install_github() instead of the recommended remotes::install_github()-Getting-started#installing-the-package). Devtools has backports as a downstream dependency, but remotes has no external dependencies. When you used devtools::install_github(), 'backports' was loaded in the background, which causes problems with updating.

A couple of notes:

Did restart R session, but didn't make a difference. Based on last error message:

When I mentioned a clean R session, I'm talking about setting the recommended RStudio configuration-Getting-started#configuring-rstudio) to never load previous R sessions on startup, which is not the default.

Not sure if this is a more common issue, but would be great if the final 'epireports' package installer would by default install 'backports', not even sure what it does and of which package it is a codependency, but otherwise it halts the installation.

This issue will not appear if users make sure their session is clean and install using remotes::install_github(), as explained in the Wiki. FWIW, I'm working on #68, which will enable users to avoid the remotes/devtools debacle.

# install.packages("drat")
drat:::add("R4EPI/epicran")
install.packages("sitrep")