PURRR Update: package ‘purrr’ had non-zero exit status

purrr
rstudio
install

#1

Rstudio 1.1.383
R 3.4.2
Ubuntu Linux 14.04 LTS (32 bit)
tidyverse 1.1.1.9000

1) When I do: Update PKGS ,
Rstudio offers to update my purrr pkg
from version: 0.2.3 to 0.2.4.

  • I click button: [Install Updates]
    --------------------------------------------------

2) Dialog box appears w/ this text:
"One or more of the packages that will be updated by this installation are currently loaded. Restarting R prior to updating these packages is strongly recommended.

RStudio can restart R and then automatically continue the installation after restarting (all work and data will be preserved during the restart).

Do you want to restart R prior to installing?."

  • I click button: [YES]
    --------------------------------------------------

3) Resulting output in Rstudio:
install.packages(“purrr”)
Installing package into ‘/home/ray/R/i686-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/purrr_0.2.4.tar.gz
Content type ‘application/x-gzip’ length 126147 bytes (123 KB)

downloaded 123 KB

  • ggplot2 2.2.1.9000 Date: 2017-10-29
  • tibble 1.3.4 R: 3.4.2
  • tidyr 0.7.2 OS: Ubuntu 14.04.5 LTS
  • readr 1.1.1 GUI: X11
  • purrr 0.2.3
  • dplyr 0.7.4
  • stringr 1.2.0
  • forcats 0.2.0
    ── Conflicts ────────────────────────────────────���──────────────────
  • filter(), from dplyr, masks stats::filter()
  • lag(), from dplyr, masks stats::lag()
  • installing source package ‘purrr’ …
    ** package ‘purrr’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c backports.c -o backports.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c coerce.c -o coerce.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c extract.c -o extract.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c flatten.c -o flatten.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c map.c -o map.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c transpose.c -o transpose.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o purrr.so backports.o coerce.o extract.o flatten.o init.o map.o transpose.o -L/usr/lib/R/lib -lR
    installing to /home/ray/R/i686-pc-linux-gnu-library/3.4/purrr/libs
    ** R
    ** inst
    ** preparing package for lazy loading
    Error in unloadNamespace(pkg_name) :
    namespace ‘purrr’ is imported by ‘tidyr’, ‘modelr’ so cannot be unloaded
  • removing ‘/home/ray/R/i686-pc-linux-gnu-library/3.4/purrr’
  • restoring previous ‘/home/ray/R/i686-pc-linux-gnu-library/3.4/purrr’
    Warning in install.packages :
    installation of cc

The downloaded source packages are in
‘/tmp/RtmpCyhyll/downloaded_packages’

--------------------------------------------------
All other Pkgs in Rstudio have always updated ok
…can somebody help? Please!..


#2

Can you try updating in a completely fresh R session (i.e. without any packages already loaded)? It looks like having packages already loaded is messing with the installation. (You can refresh your R session in RStudio with CTRL+SHIFT+F10).


#3

Hi Jim,

Thanks for answering!.

As suggested,
I refreshed my R session in RStudio
with CTRL+SHIFT+F10
(or also from the Rstudio dropdown menu: Session/Restart R).

I did not help. :frowning:
Still get the “non-zero exit status”,
when I try to update any of the PKGS:
ie: purrr, glue, lazyeval, lubridate…

btw:
after the CTRL+SHIFT+F10 (Restart R),
all my usual PKGS still show as loaded in the workspace,
under the “Global Environment” menu…

search()
[1] “.GlobalEnv” “tools:rstudio”
[3] “package:skimr” “package:visdat”
[5] “package:forcats” “package:stringr”
[7] “package:dplyr” “package:purrr”
[9] “package:readr” “package:tidyr”
[11] “package:tibble” “package:ggplot2”
[13] “package:tidyverse” “package:stats”
[15] “package:graphics” “package:grDevices”
[17] “package:utils” “package:datasets”
[19] “package:methods” “Autoloads”
[21] “package:base”

What should I try next?
thks!


#4

Do you have any packages loaded when you try and update? What do you get if
you just install rather than update? (install.packages())


#5

Hi Jim!

Found:
a) the reason (for all pkg updates giving “non-zero exit”)
and
b) a workaround
(maybe you can suggest shorter solution to avoid this problem for future pkg updates).

So, this is the solution…

a) the reason:
I had an initial “.Rprofile” file,
which became effective
every time I started Rstudio.

It included this command:

.First <- function() {
autoloads <- c(“tidyverse”,“visdat”,“skimr”)
options(defaultPackages = c(getOption(“defaultPackages”), autoloads))
}

Somehow, the pkgs autoloaded (above),
interfered with the update of purrr and other pkgs!.

b) my (long) workaround:
I commented-out the above code
in my .Rprofile file: (w/ CTRL-SHIFT-C)

# .First <- function() {
# autoloads <- c(“tidyverse”,“visdat”,“skimr”)
# options(defaultPackages = c(getOption(“defaultPackages”), autoloads))
# }

I then re-started my Rstudio
with the temporary commented-out .Rprofile code,
and clicked [Update] in the Packages pane.

Great!.
ALL pkgs updated fine!.
(no more “non-zero exit” status!).
YAY!

Then… I uncommented
the commented .Rprofile code (CTRL-SHIFT-C again),
saved and sourced it,
and restarted Rstudio again.

JIM,

  • maybe you can suggest a shorter solution
    with more practical solution/steps,
    to avoid this problem for future pkg updates.
    Instead of this LOOOONG sol
    every time there is a PKG update…

Hey!
My hair is already turning white, as it is :slight_smile:


#6

I’m not sure of any easy way around your exact problem, but it’s generally
not a great idea to put code in an Rprofile that loads packages / makes
changes to an otherwise “fresh” R environment. It makes your code less
reproducible and (as you have found) can lead to unexpected errors that are
hard to debug.


#7

Yes Jim,
you are absolutely right,
ref auto-loading some R pkgs via the .Rprofile file…

I now learned the hard way…

Jim,
is there any “safer” way (w/o .Rprofile)
to always auto-load some needed R pkgs
ie: tidyverse, visdat…,
every time I start Rstudio?.

or maybe (when so needed),
a way/flag/parameter
to sometimes start Rstudio,
w/o the “.Rprofile” file?.

That would be very helpful…


#8

Not that I can think of. .Rprofile is the main way to set start-up values; it’s not necessarily unsafe, you just need to remember that you have done it if you run in to errors, and before you share code that depeneds on packages loaded in .Rprofile with other people (in case they don’t have those packages!).


#9

I’d highly recommend not loading packages in your .Rprofile. As you’ve seen it can causes problems when updating packages, and in general is likely to lead to less reproducible code.


#10

Thank you
for all your patient help, Jim.

Learned my lesson.
.Rprofile file not “unsafe” per-se,
but keep in mind (if you have it).

.Rprofile:
A practical solution
but may turn into a potential problem, later.


#11

100% understood, Hadley.
Will keep your good advice in mind,
for sure.

I certainly learned my lesson!.