Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-03-23 19:20
(2088 d 16:41 ago)

Posting: # 20071
Views: 4,502
 

 Update R and its libraries [🇷 for BE/BA]

Dear RUsers,

it is good practice to update R and its libraries regularly. Bugs are removed, new functions added, and performance improved (e.g., subject simulations in PowerTOST run now 100times faster than originally).

Novices please read only the 1st section and ignore the other.
  1. Download-links: Windows, Linux, OS X.
    When asked which flavour (32-, 64-bit, both) to install, opt for the one matching your OS.
    Copy the entire library-folder of the previous installation to the new one. If asked whether newer files should be overwritten, answer N!
    Open the R-console and type update.packages(checkBuilt=TRUE, ask=FALSE). You can make package-maintainers happy when you select the first CRAN mirror (0-Cloud). If you want to be patriotic, select one of the local mirrors close to you.
    That’s all.

  2. Same as above. With 15,000+ packages on CRAN it takes a while till all are compiled (both 32- and 64-bit for Windows; on Linux and OS X one works with the sources anyway) – especially when a new release of R is rolled out. If you are a nerd, likely you have the Rtools and devtools on your machine. If some of your a libraries are not compiled yet, you may see sumfink like this:
      There is a binary version available but the source version is later:
                binary source needs_compilation
    cairoDevice   2.25   2.26              TRUE

    When asked for compilation you can chicken out (N) or bravely answer: Yes, I’m a nerd! This should work if you read all the small print (I didn’t).
    • Rtools have to be installed in C:\Rtools (another location or a network drive is not allowed).
    • Window’s path-variable has to be set appropriately: C:\Rtools\bin; must be the first line (even before C:\Windows;).
    If you are fine with that, you’re done. Happy compiling!

    However, the installer asks whether you want to install it somewhere else. Possible, but not without pitfalls.
    Since you are a nerd, I bet you prefer to have operating system(s) on C, software on D, and data on yet other drive(s). If you installed it say on D (like I did) you will be punished. Though you adapted the path-variable, you are slapped in the face with sumfink like this:
    * installing *source* package 'cairoDevice' ...
    ** package 'cairoDevice' successfully unpacked and MD5 sums checked
    ** libs
    c:/Rtools/mingw_64/bin/gcc -I"D:/PROGRA~2/R/R-35~1.3/include" -DNDEBUG -D_R_=1 -DUSE_R=1 -mms-bitfields -I/include/gtk-2.0 -I/lib/gtk-2.0/include -I/include/atk-1.0 -I/include/cairo -I/include/pango-1.0 -I/include/glib-2.0 -I/lib/glib-2.0/include -I/include/cairo -I/include/gdk-pixbuf-2.0 -I/include -ID:/PROGRA~2/R/R-35~1.3/include -O2 -Wall -std=gnu99 -mtune=generic -c R_init_cairoDevice.c -o R_init_cairoDevice.o
    sh: c:/Rtools/mingw_64/bin/gcc: No such file or directory
    make: *** [D:/PROGRA~2/R/R-35~1.3/etc/x64/Makeconf:208: R_init_cairoDevice.o] Error 127
    ERROR: compilation failed for package 'cairoDevice'
    * removing 'D:/Program Files/R/R-3.5.3/library/cairoDevice'
    * restoring previous 'D:/Program Files/R/R-3.5.3/library/cairoDevice'

    Why the heck? After discussions with the maintainer on GitHub it is clear that the paths to the two compilers are hardcoded (!) to C:/Rtools/mingw_$(WIN)/bin/. Hence, whatever I tried the last years was futile.
    Solution:
    • Delete everything (yes!) pointing to Rtools and its subfolders from the path-variable.
    • Close all R-sessions and start a new one.
      remotes::install_github('jeroen/makeconf')
      library(makeconf)
      makeconf::rtools_setup()

      If you get errors, keep them…
    Now compilation worked with one exception (cause I don’t have libgtk on my machine).
    Checking the DESCRIPTION-file of library Matrix (the compiled version on CRAN is 1.2-16):
    Version: 1.2-17
    Date: 2019-03-11
    NeedsCompilation: yes
    Packaged: 2019-03-20 21:37:04 UTC; maechler
    Date/Publication: 2019-03-22 22:56:52 UTC
    Built: R 3.5.3; x86_64-w64-mingw32; 2019-03-23 16:03:44 UTC; windows

    Bingo!

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2019-03-23 22:53
(2088 d 13:08 ago)

@ Helmut
Posting: # 20072
Views: 3,634
 

 Update R and its libraries

Dear Helmut,

❝ cairoDevice 2.25 2.26 ...


Same here on Windows. Linux and macOS have no problem (always) at all to get upgraded. However, my solution is just to wait until the binary zip is ready on CRAN. That is because I never get luck to succeed in this case. Last time it occurred with RGtk2 package. It took about one week to wait for the binary zip file.

❝ ... Now compilation worked with one exception (cause I don’t have libgtk on my machine).


Then I was wondering now. How did you install package cairoDevice previously without GTK library installed beforehand? with its binary zip file?

All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-03-24 00:46
(2088 d 11:15 ago)

@ yjlee168
Posting: # 20075
Views: 3,700
 

 Update R and its libraries

Hi Yung-jin,

❝ Linux and macOS have no problem (always) at all to get upgraded.


Yep. libgtk is part of the major Linux distributions (Debian, Ubuntu). OS X is not my thing. ;-)

❝ However, my solution is just to wait until the binary zip is ready on CRAN.


The pragmatic solution. Perfect.

❝ How did you install package cairoDevice previously without GTK library installed beforehand? with its binary zip file?


Yes. I rarely need it, so I’m happy being a minor version behind for a while.


Edit: What might be OK for users, is not if one wants to build a package in RStudio. :not really:
In checking RStudio threw warnings that “version 3.3 of the Rtools are not compatible with R 3.5.3” (heck, I have v3.5.0.4). When ignoring the warnings, building works. I turned out that RStudio used Strawberry’s gcc-compiler (v4.8.2). Oh, my goodness. The one in RTools is v4.9.3 (of June 26, 2015). Current is v8.3 (of last February).
I gave in. Rtools in C, first in path, RStudio happy.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
UA Flag
Activity
 Admin contact
23,335 posts in 4,901 threads, 1,668 registered users;
53 visitors (0 registered, 53 guests [including 8 identified bots]).
Forum time: 12:01 CET (Europe/Vienna)

Every man is fully satisfied that there is such a thing as truth,
or he would not ask any question.    Charles Sanders Peirce

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5