Opened 10 years ago

Last modified 3 years ago

#46786 new defect

R changes broke rNMR package

Reported by: howarth.at.macports@… Owned by: kjellpk (Kjell Konis)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: cooljeanius (Eric Gallager)
Port: R

Description (last modified by larryv (Lawrence Velázquez))

The recent changes to R seem to have broken the rNMR package. On a clean install of MacPorts, in order to install rNMR, I had to use the +tcltk variant of R which in turn required installing the +x11 variant of tk. After this rNMR would build and install but now fails at run time with the error...

Error in .First() : could not find function "gui"
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘rNMR’

Attachments (2)

Portfile.diff (2.0 KB) - added by howarth.at.macports@… 10 years ago.
Portfile diff to install rNMR into ${prefix}/Library/Frameworks/R.framework/Resources/library
rNMR.sh (137 bytes) - added by howarth.at.macports@… 10 years ago.
revised rNMR.sh file to use ${prefix}/Library/Frameworks/R.framework/Resources/library

Download all attachments as: .zip

Change History (16)

comment:1 Changed 10 years ago by larryv (Lawrence Velázquez)

Description: modified (diff)
Owner: changed from macports-tickets@… to kjell.konis@…

comment:2 Changed 10 years ago by kjellpk (Kjell Konis)

I downloaded the source here

http://rnmr.nmrfam.wisc.edu/pages/download/files/Source%20code/current/rNMR_1.1.8_source.zip

and rNMR is pretty clearly not an R package.

Could you maybe be more specific about how you obtained rNMR and how you installed it?

comment:3 Changed 10 years ago by howarth.at.macports@…

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 Changed 10 years ago by kjellpk (Kjell Konis)

There is a bug in the file loadrNMR.R. It tries to load the rNMR package but does not provide a lib.loc argument. This

require(rNMR, lib.loc = "${prefix}/lib/R/library", quietly=TRUE, warn.conflicts=FALSE)

would do the trick (where ${prefix} is the MacPorts prefix).

comment:5 Changed 10 years ago by howarth.at.macports@…

The attached patch solves the startup problem with rNMR. There still is a later problem when testing the program on the test data set related to recent tcl/tk changes.

http://rnmr.nmrfam.wisc.edu/pages/data/files/rNMR_HSQC_Example.zip

If you follow the instructions on http://rnmr.nmrfam.wisc.edu/pages/data/data.html

cd rNMR_HSQC_Example
rRNMR
<select open menu item in Menus window  from rNMR>
<select rNMR_HSQC_Example directory in Open dialog from rNMR>
<shift click to select all of the *.hsqc files in the Open dialog from rNMR>
<click the Open button in the Open dialog from rNMR>

This produces an error message...

Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
  [tcl] invalid command name "tablelist::tablelist".

which wasn't present until the recent R/tcl/tk revisions in MacPorts. Currently I have...

tk @8.6.3_0+x11 (active)
tcl @8.6.3_0+threads

which always worked in the past.

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 10 years ago by howarth.at.macports@…

Also, why is the fact the

lib.loc = "${prefix}/lib/R/library"

is now required not considered a regression in the R packaging? This isn't the case with fink, linux or the previous MacPorts R packaging.

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:7 in reply to:  5 Changed 10 years ago by kjellpk (Kjell Konis)

Your example works fine for me:

Prompty$ R CMD INSTALL rNMR_1.1.7.tar.gz 
* installing to library ‘/Users/kjellk/Library/R/3.1/library’
* installing *source* package ‘rNMR’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rNMR)
Prompty$ R

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin14.1.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(rNMR)
Loading required package: tcltk

 rNMR version 1.1.7 (2011-08-03) 
 Copyright (C) 2009 Ian A. Lewis and Seth C. Schommer
 rNMR is free software and comes with ABSOLUTELY NO WARRANTY.
 rNMR may be modified and redistributed under certain conditions.
 Go to http://www.r-project.org/Licenses/GPL-3 for more details.

 Citation:
 Lewis, I. A., Schommer, S. C., Markley, J. L.
 Magn. Reson. Chem. 47, S123-S126 (2009).

> [1] 0 Hrs a.hsqc
[1] 0 Hrs b.hsqc
[1] 0 Hrs c.hsqc
[1] 1.5 Hrs a.hsqc
[1] 1.5 Hrs b.hsqc
[1] 1.5 Hrs c.hsqc
[1] 12 Hrs a.hsqc
[1] 12 Hrs b.hsqc
[1] 12 Hrs c.hsqc
[1] 3 Hrs a.hsqc
[1] 3 Hrs b.hsqc
[1] 3 Hrs c.hsqc
[1] 6 Hrs a.hsqc
[1] 6 Hrs b.hsqc
[1] 6 Hrs c.hsqc
[1] Alanine.hsqc
[1] BPG.hsqc
[1] Glucose.hsqc
[1] HEPES.hsqc
[1] Lactate.hsqc
[1] Pyruvate.hsqc

Performing automatic backup . . . complete

>

I get a Main Plot Window, a Files browser (showing the hsqc files in your example), and a Menus bar.

The problem appears to only manifest itself when you install the rNMR R package through the rNMR port.

Replying to howarth.at.macports@…:

The attached patch solves the startup problem with rNMR. There still is a later problem when testing the program on the test data set related to recent tcl/tk changes.

http://rnmr.nmrfam.wisc.edu/pages/data/files/rNMR_HSQC_Example.zip

If you follow the instructions on http://rnmr.nmrfam.wisc.edu/pages/data/data.html

cd rNMR_HSQC_Example
rRNMR
<select open menu item in Menus window  from rNMR>
<select rNMR_HSQC_Example directory in Open dialog from rNMR>
<shift click to select all of the *.hsqc files in the Open dialog from rNMR>
<click the Open button in the Open dialog from rNMR>

This produces an error message...

Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
  [tcl] invalid command name "tablelist::tablelist".

which wasn't present until the recent R/tcl/tk revisions in MacPorts. Currently I have...

tk @8.6.3_0+x11 (active)
tcl @8.6.3_0+threads

which always worked in the past.

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:8 Changed 10 years ago by howarth.at.macports@…

Okay, The problem is that the new R update breaks the previous support for installing R packages in ${prefix}/lib/R/library. Now ${prefix}/Library/Frameworks/R.framework/Resources/library must be used. Either the old behavior needs to be restored to R or the attached Portfile.diff and revised rNMR.sh file needs to be committed to the install rNMR into ${prefix}/Library/Frameworks/R.framework/Resources/library rather than ${prefix}/lib/R/library.

Changed 10 years ago by howarth.at.macports@…

Attachment: Portfile.diff added

Portfile diff to install rNMR into ${prefix}/Library/Frameworks/R.framework/Resources/library

Changed 10 years ago by howarth.at.macports@…

Attachment: rNMR.sh added

revised rNMR.sh file to use ${prefix}/Library/Frameworks/R.framework/Resources/library

comment:9 Changed 10 years ago by howarth.at.macports@…

Note that updating the packaging to the latest 1.1.8 release of rNMR will be problematic as that release accesses the X11 server during the R CMD INSTALL. In my fink rnmr-r.info for 1.1.8, I worked around that by using our xvfb-run package which allows commands to be executed on a virtual frame buffer. Does MacPorts have a similar package somewhere that allows the xvfb to be used for this purpose?

comment:10 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Your patches are dealt with in #46838.

comment:11 Changed 10 years ago by kjellpk (Kjell Konis)

I would recommend against installing the rNMR package in the R.framework. Why not just ${prefix}/lib/rNMR (or whatever) and just modify rNMR.sh to load the package from there? My concern is that presently

${prefix}/Library/Frameworks/R.framework/Resources

is a symlink to

/MacPorts/Library/Frameworks/R.framework/Versions/3.1/Resources

so that's where the rNMR package is going to end up. When R gets upgraded to 3.2.x, rNMR won't be found.

comment:12 Changed 10 years ago by kjellpk (Kjell Konis)

Also, some R users may not want rNMR to delete their saved workspace when it starts up.

comment:13 Changed 10 years ago by howarth.at.macports@…

The real solution is to, like fink, settle on some common directory outside of ${prefix}/Library/Frameworks/R.framework/Versions/3.1/Resources where we want the R packages to installed and create the appropriate site-library symlink in ${prefix}/Library/Frameworks/R.framework/Versions/3.1/Resources. This is easily demonstrated with the current R package...

% R

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin14.3.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>  .libPaths()
[1] "/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library"
> 

and the proper fix proven with...

sudo mkdir -p /opt/local/lib/R/library
cd /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/
ln -s /opt/local/lib/R/library site-library

which then causes R to exhibit the desired behavior of...

% R 

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin14.3.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> .libPaths()
[1] "/opt/local/lib/R/library"                                                
[2] "/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library"
> 

comment:14 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added
Note: See TracTickets for help on using tickets.