where is rpy2

67 views
Skip to first unread message

William Stein

unread,
Mar 25, 2023, 12:29:32 PM3/25/23
to sage-devel
Hi,

According to

https://doc.sagemath.org/html/en/reference/spkg/rpy2.html#spkg-rpy2

the rpy2 package is a "standard package". However, I just checked
multiple builds in various places of sage-9.8 and also the latest
master branch, and rpy2 is not installed.

I can see why rpy2 isn't installed. It's because for sage-9.8 R was
deprecated from being a standard package to an optional package, and
of course there is no way to install rpy2 if a sufficiently library
usable R isn't installed.

1. What is the definition these days of a standard package? Is a
standard package "A package that might or might not be installed,
depending on what happens to be available when ./configure was run?"
A standard package used to be a package that was definitely installed
in every copy of Sage. It seems to me that these days there are three
types of packages:

- definitely installed in every copy of sage. An example is pari.
- there's an attempt to install them when sage gets built, if
conditions are right: an example is rpy2
- they are definitely not installed when sage is initially built:
example include various specialized databases.

2. A possible suggestion for improving the error messages. Just
doing "sage -i rpy2" doesn't work, because that complains that R isn't
installable:

[...]
[r-none] If the system package is installed, ./configure will check
whether it can be used.
[r-none]
[r-none]
[r-none] Error: r is a dummy package and
[r-none] cannot be installed using the Sage distribution.

OK, I realize I need to follow the directions above (about ubuntu),
and then I get r dev installed. I guess I know enough to
actually run ./configure again, and then I do "sage -i rpy2", and then
that does a LOT, e.g., spending hour(s) building gmp, mpfr, etc.
(why? because I ran ./configure?).

Why does it say "If the system package is installed, ./configure will
check whether it can be used."? This isn't
user friendly. It should say: "Ensure that the system R package is
installed, then run ./configure. After you do that, you can then
run 'sage -i rpy2'."

MOTIVATION: For every version of Sage up to and including 9.7, users
could use rpy2, which lots of little bits of sage evidently
now rely on,e g., "r.mean([3,7,9])". By deprecating the R
package entirely, thus making rpy2 into a sudo-standard package
in version 9.8, using the r interface is just broken, since it uses rpy2.

My guess is that rpy2 and all code that depends on R should be made
optional packages and marked #optional in the docs, etc.,
and it's just a bug that hasn't been done? Alternatively, we have to
make it so that building Sage depends on R being installed, or
we have to change the definition of "standard" package.

--
William (http://wstein.org)

Matthias Koeppe

unread,
Mar 25, 2023, 2:53:07 PM3/25/23
to sage-devel
rpy2 is built by default when a suitable system R is detected.

Matthias Koeppe

unread,
Mar 25, 2023, 2:57:01 PM3/25/23
to sage-devel
On Saturday, March 25, 2023 at 9:29:32 AM UTC-7 William Stein wrote:
It seems to me that these days there are three
types of packages:

...at least...
 
- definitely installed in every copy of sage. An example is pari.
- there's an attempt to install them when sage gets built, if
conditions are right: an example is rpy2
- they are definitely not installed when sage is initially built:
example include various specialized databases.

That's right.
 

Matthias Koeppe

unread,
Mar 25, 2023, 2:59:56 PM3/25/23
to sage-devel
On Saturday, March 25, 2023 at 9:29:32 AM UTC-7 William Stein wrote:
My guess is that rpy2 and all code that depends on R should be made
optional packages and marked #optional in the docs, etc.,
and it's just a bug that hasn't been done? 

Details? Where do you think it is missing?
 

Dima Pasechnik

unread,
Mar 25, 2023, 3:13:23 PM3/25/23
to sage-devel


On Sat, 25 Mar 2023, 18:57 Matthias Koeppe, <matthia...@gmail.com> wrote:
On Saturday, March 25, 2023 at 9:29:32 AM UTC-7 William Stein wrote:
It seems to me that these days there are three
types of packages:

...at least...
 
- definitely installed in every copy of sage. An example is pari.

pari can well come from the system - assuming it passes various ./configure tests.

I would not call this "installed".


- there's an attempt to install them when sage gets built, if
conditions are right: an example is rpy2
- they are definitely not installed when sage is initially built:
example include various specialized databases.

That's right.

you can force non-standard packages being built by passing the relevant option to ./configure

e.g. 

   ./configure --enable-fricas=yes

will result in an attempt to build fricas during the initial build (or the subsequent build, whichever is applicable)

 

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/dd78db41-9855-4f5a-baff-68cd8d9ac536n%40googlegroups.com.

William Stein

unread,
Mar 25, 2023, 3:40:52 PM3/25/23
to sage-...@googlegroups.com
On Sat, Mar 25, 2023 at 11:53 AM Matthias Koeppe
<matthia...@gmail.com> wrote:
>
> rpy2 is built by default when a suitable system R is detected.

Thanks. This is exactly my understanding.

The Sage docs https://doc.sagemath.org/html/en/developer/packaging.html define
standard, optional and experimental packages. The definition of
standard package is:

"standard packages are built by default. For a few packages,
configure checks whether they are available from the system, in which
case the build of those packages is skipped.".

This is not true of rpy2, so it is a bug that rpy2 is a standard package.

Probably rpy2 should be completely removed from sage, and people
should pip install it instead. However, instructions to do that could
be provided if anybody touches the "r." interface...

-- William




--
William (http://wstein.org)

William Stein

unread,
Mar 25, 2023, 3:43:48 PM3/25/23
to sage-...@googlegroups.com
On Sat, Mar 25, 2023 at 12:13 PM Dima Pasechnik <dim...@gmail.com> wrote:
>
>
>
> On Sat, 25 Mar 2023, 18:57 Matthias Koeppe, <matthia...@gmail.com> wrote:
>>
>> On Saturday, March 25, 2023 at 9:29:32 AM UTC-7 William Stein wrote:
>>
>> It seems to me that these days there are three
>> types of packages:
>>
>>
>> ...at least...
>>
>>
>> - definitely installed in every copy of sage. An example is pari.
>
>
> pari can well come from the system - assuming it passes various ./configure tests.
>
> I would not call this "installed".

When I introduced the terminology "standard package" 18 years ago (?)
it meant "definitely installed in every copy of sage." which is why
https://doc.sagemath.org/html/en/developer/packaging.html says:
"standard packages are built by default."

I'm fine with the definition changing, but the docs need to be
updated to reflect that. They were updated to reflect just the
requirement that the package is available (not necessarily built):
"For a few packages, configure checks whether they are available from
the system, in which case the build of those packages is skipped."
That's great.

I'm just pointing out that rpy2 doesn't fit into these definitions
right now, which is confusing.


>
>>
>> - there's an attempt to install them when sage gets built, if
>> conditions are right: an example is rpy2
>> - they are definitely not installed when sage is initially built:
>> example include various specialized databases.
>>
>>
>> That's right.
>
>
> you can force non-standard packages being built by passing the relevant option to ./configure
>
> e.g.
>
> ./configure --enable-fricas=yes
>
> will result in an attempt to build fricas during the initial build (or the subsequent build, whichever is applicable)
>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/dd78db41-9855-4f5a-baff-68cd8d9ac536n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq1ZH%2BRce10kbPRr3oXb1HFcehbMq%2B-Qp9Fn00it8w9xmQ%40mail.gmail.com.



--
William (http://wstein.org)

Dima Pasechnik

unread,
Mar 25, 2023, 3:52:00 PM3/25/23
to sage-devel
I propose to introduce the notion of semistandard package. 

Or perhaps weakly standard one?

Substandard would be too confusing IMHO...

Dr. David Kirkby

unread,
Mar 25, 2023, 3:55:57 PM3/25/23
to sage-...@googlegroups.com
On Sat, 25 Mar 2023 at 16:29, William Stein <wst...@gmail.com> wrote:
OK, I realize I need to follow the directions above (about ubuntu),
and then I get r dev installed. 

When I installed R on Ununtu I found the version was several years old. I eventually installed it from the source code which is quite a hassle as it has so many dépendances  - but I guess that you know that. 

Dave 
--
Dr. David Kirkby,
Kirkby Microwave Ltd,
drki...@kirkbymicrowave.co.uk
https://www.kirkbymicrowave.co.uk/
Telephone 01621-680100./ +44 1621 680100

Registered in England & Wales, company number 08914892.
Registered office:
Stokes Hall Lodge, Burnham Rd, Althorne, Chelmsford, Essex, CM3 6DT, United Kingdom

Matthias Koeppe

unread,
Mar 25, 2023, 4:40:19 PM3/25/23
to sage-devel
On Saturday, March 25, 2023 at 12:52:00 PM UTC-7 Dima Pasechnik wrote:
I propose to introduce the notion of semistandard package. 

 "Semistandard" sounds good to me.

We have a few more packages that are of this type:
- sqlite is only installed if we build our own copy of python3
- openssl is only installed if we build our own copy of python3 or curl

And some packages can probably be promoted from "optional" to "semistandard".
- jupymake - should probably be installed when a system polymake is found
- more to come as part of the modularization.

 

William Stein

unread,
Mar 25, 2023, 4:42:43 PM3/25/23
to sage-...@googlegroups.com
+1
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/548532e6-4cba-4d38-bd1e-093b08f2429an%40googlegroups.com.



--
William (http://wstein.org)

Matthias Koeppe

unread,
Mar 25, 2023, 4:44:31 PM3/25/23
to sage-devel
I've opened issue https://github.com/sagemath/sage/issues/35347 for this

Emmanuel Charpentier

unread,
Mar 25, 2023, 4:56:23 PM3/25/23
to sage-devel
Ahem... There are two components to consider :

- the package by itself

- its interface to Sagemath.

Case in point : the Mathematica interface, which is standard (*i. e.* installed in all cases), but active if and only if Mathematica (or the Wolfram engine) is present in the target system.

This distinction has not been made in the case of R. I do not know if `rpy2` can be installed in a system not having R.

A possible solution could mimin the mathematica interface, which raises an exception when  called on an system without a mathematica engine installed : it prints an inforrmative message 
pointing to the possible solutions of the problem...

HTH,

Dima Pasechnik

unread,
Mar 25, 2023, 5:01:07 PM3/25/23
to sage-...@googlegroups.com
On Sat, Mar 25, 2023 at 8:56 PM Emmanuel Charpentier
<emanuel.c...@gmail.com> wrote:
>
> Ahem... There are two components to consider :
>
> - the package by itself
>
> - its interface to Sagemath.
>
> Case in point : the Mathematica interface, which is standard (*i. e.* installed in all cases), but active if and only if Mathematica (or the Wolfram engine) is present in the target system.
>
> This distinction has not been made in the case of R. I do not know if `rpy2` can be installed in a system not having R.

It cannot - it needs R headers and R dynamic library to build.

>
> A possible solution could mimin the mathematica interface, which raises an exception when called on an system without a mathematica engine installed : it prints an inforrmative message
> pointing to the possible solutions of the problem...
>
> HTH,
> Le samedi 25 mars 2023 à 21:44:31 UTC+1, Matthias Koeppe a écrit :
>>
>> I've opened issue https://github.com/sagemath/sage/issues/35347 for this
>>
>>
>> On Saturday, March 25, 2023 at 1:40:19 PM UTC-7 Matthias Koeppe wrote:
>>>
>>> On Saturday, March 25, 2023 at 12:52:00 PM UTC-7 Dima Pasechnik wrote:
>>>
>>> I propose to introduce the notion of semistandard package.
>>>
>>>
>>> "Semistandard" sounds good to me.
>>>
>>> We have a few more packages that are of this type:
>>> - sqlite is only installed if we build our own copy of python3
>>> - openssl is only installed if we build our own copy of python3 or curl
>>>
>>> And some packages can probably be promoted from "optional" to "semistandard".
>>> - jupymake - should probably be installed when a system polymake is found
>>> - more to come as part of the modularization.
>>>
>>>
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/9e8df3f3-9cd3-4818-8760-9d072bb295cdn%40googlegroups.com.

Matthias Koeppe

unread,
Mar 25, 2023, 5:24:59 PM3/25/23
to sage-devel
On Saturday, March 25, 2023 at 1:56:23 PM UTC-7 Emmanuel Charpentier wrote:
A possible solution could mimin the mathematica interface, which raises an exception when  called on an system without a mathematica engine installed : it prints an inforrmative message 
pointing to the possible solutions of the problem...

Reply all
Reply to author
Forward
0 new messages