Closed 7822f248-ba56-45f1-ab3d-4de7482bdf9f closed 5 years ago
What exactly is meant by can't install the R package "Cairo"
?
Look for yourself :
charpent@p-202-021:~$ sage -R
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
[ Snip... ]
[Sauvegarde de la session précédente restaurée]
> install.packages("Cairo")
--- SVP sélectionner un miroir CRAN pour cette session ---
[ re-Snip... ]
Selection: 32
essai de l'URL 'https://cran.univ-paris1.fr/src/contrib/Cairo_1.5-9.tar.gz'
Content type 'application/x-gzip' length 86982 bytes (84 KB)
==================================================
downloaded 84 KB
* installing *source* package ‘Cairo’ ...
** package ‘Cairo’ correctement décompressé et sommes MD5 vérifiées
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pkg-config... /usr/local/sage-8/local/bin/pkg-config
checking whether pkg-config knows about cairo... yes
checking for configurable backends... cairo cairo-ft cairo-pdf cairo-png cairo-ps cairo-xlib cairo-xlib-xrender
configure: CAIRO_CFLAGS=-I/usr/local/sage-8/local/include -I/usr/local/sage-8/local/include/freetype2 -I/usr/local/sage-8/local/include -I/usr/local/sage-8/local/include/libpng16 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid
checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-L/usr/local/sage-8/local/lib -lfreetype -lz -lpng16 -lz -lcairo -lXext -lXrender -lX11
checking for library containing deflate... no
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/usr/local/sage-8/local/lib/R/library/Cairo’
Les packages source téléchargés sont dans
‘/tmp/RtmphJPGGK/downloaded_packages’
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
impossible de charger l'objet partagé '/usr/local/sage-8/local/lib/R//modules//R_X11.so':
/usr/lib/x86_64-linux-gnu/libcairo.so.2: undefined symbol: FT_Done_MM_Var
2: In install.packages("Cairo") :
l'installation du package ‘Cairo’ a eu un statut de sortie non nul
>
Note that R tries to use the system's cairo libraries...
It all works for me on a Debian stretch system after apt install libcairo-dev
.
(without it, Sage's R cannot even find cairo.h
header).
There is of course no telling in general whether your cairo installation is compatible with Sage's R, I guess this problem was always there, it's just that you finally hit this incompatibility.
I am inclined to close this as worksforme. I think the best way to proceed is to add capability to use system R installation, via adding appropriate spkg-configure.m4
to build/pkgs/r
.
Replying to @dimpase:
I am inclined to close this as worksforme. I think the best way to proceed is to add capability to use system R installation, via adding appropriate
spkg-configure.m4
tobuild/pkgs/r
.
I disagree :
I had trouble getting R graphics capabilities when I started using Sage's R, about 5 years ago (?). After installatin of the relevant (system) libraries, I didn't have this problem.
The problem isn't specifi to Cairo : ALL graphics capabilities are missing...
in my system :
charpent@p-202-021:~$ apt-get install -s libcairo-dev
NOTE: Ceci n'est qu'une simulation !
apt-get a besoin des privilèges du superutilisateur
pour pouvoir vraiment fonctionner.
Veuillez aussi noter que le verrouillage est désactivé,
et la situation n'est donc pas forcément représentative
de la réalité !
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Note : sélection de « libcairo2-dev » au lieu de « libcairo-dev »
libcairo2-dev est déjà la version la plus récente (1.16.0-2).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
Something else has changed... Maybe because I'm running buster
(i. e. testing
) rather than stretch
(i. e. stable
) ?
ISTR that Erik Madison Bray once had a proposal to use system's R as the Sage R interpreter. I'd be interested in knowing more...
zhe ne kompran pa your error messages :-)
Naturally all bets are off for a testing distro. You might try installing system's R ans check whether you get Cairo there.
Replying to @dimpase:
zhe ne kompran pa your error messages :-)
My systems has fr_FR.UTF8 locale...
Naturally all bets are off for a testing distro.
I am aware of very few people running stable
on a desktop. testing
is usually the right compromise.
(Of course, on a server, stable
is probably de rigueur ;-).
And since testing
is the next stable
(trnsition underway), I don't think that detecting a problem on it is irrelevant to Sage...
You might try installing system's R
Done since about 21 years (R is my professional bread and butter, replacing SAS), and religiously maintained (following Debian's packaging).
ans check whether you get Cairo there.
I do :
charpent@p-202-021:~$ R
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R est un logiciel libre livré sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de détails.
R est un projet collaboratif avec de nombreux contributeurs.
Tapez 'contributors()' pour plus d'information et
'citation()' pour la façon de le citer dans les publications.
Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.
[Sauvegarde de la session précédente restaurée]
> "Cairo" %in% row.names(installed.packages())
[1] TRUE
>
I'm maintaining Sage's R installation because :
I want to be able to "lighten up" my setup someday and getting rid of system's R installation (about 500 packages, ising about 1.7 Gb for its library).
And also to keep it up-to-date for Sage users who need it occasionally without having to maintain a system installation.
BTW : the "Cairo" issue blocks a couple of R packages that depend on it. And the lack of any graphical ability is much more preoccupying...
I stand by my statement that this needs fixing.
So a quick solution would be to upgrade Sage's R to 3.5.2 and pray that such an upgrade won't break things on, say, debian stable (which I am running in a container on a ChromeOS laptop, not on a server :-))
I'm pretty sure this has nothing to do with my recent change in the R
interface. sage -R
doesn't actually have much (if anything) to do with sage. It just starts the version of R that sage uses. That wasn't touched by my changes.
If you're sure the issue is new and was introduced by some sage update, maybe try git-bisect
.
Please review #25674 - I checked that installing Cairo still works on Debian stretch, please check whether this fixes graphics problems on Debian buster.
Replying to @dimpase:
Please review #25674 - I checked that installing Cairo still works on Debian stretch,
Did you chheck that you had graphics capabilities()
?
please check whether this fixes graphics problems on Debian buster.
Underway...
I get, after installing Cairo,
> capabilities()
jpeg png tiff tcltk X11 aqua
FALSE TRUE FALSE FALSE TRUE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE TRUE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE FALSE TRUE FALSE TRUE TRUE
It looks good enough to me.
Replying to @dimpase:
I get, after installing Cairo,
> capabilities() jpeg png tiff tcltk X11 aqua FALSE TRUE FALSE FALSE TRUE FALSE http/ftp sockets libxml fifo cledit iconv TRUE TRUE TRUE TRUE TRUE TRUE NLS profmem cairo ICU long.double libcurl TRUE FALSE TRUE FALSE TRUE TRUE
It looks good enough to me.
png()
is essential and here, ditto for cairo()
; tiff()
is sometimes necessary to fulfill (exceedingly) retro desiderata of some medical journals' instructions to authors, and jpeg()
is handy for some HTML tools who dislike png()
for some unreasonable reason.
So, yes, that's good enough, if I can get that under buster
.
Build still underway on another buster
machine (merging develop and #25674).
Replying to @dimpase:
I get, after installing Cairo,
> capabilities() jpeg png tiff tcltk X11 aqua FALSE TRUE FALSE FALSE TRUE FALSE http/ftp sockets libxml fifo cledit iconv TRUE TRUE TRUE TRUE TRUE TRUE NLS profmem cairo ICU long.double libcurl TRUE FALSE TRUE FALSE TRUE TRUE
It looks good enough to me.
No such luck on buster. After getting #25674 and merging develop
, I get :
charpent@zen-book-flip:/usr/local/sage-8$ sage -R
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R est un logiciel libre livré sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de détails.
R est un projet collaboratif avec de nombreux contributeurs.
Tapez 'contributors()' pour plus d'information et
'citation()' pour la façon de le citer dans les publications.
Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.
> capabilities()
jpeg png tiff tcltk X11 aqua
FALSE FALSE FALSE TRUE FALSE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE TRUE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE FALSE FALSE TRUE TRUE TRUE
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
impossible de charger l'objet partagé '/usr/local/sage-8/local/lib/R//modules//R_X11.so':
/usr/lib/x86_64-linux-gnu/libcairo.so.2: undefined symbol: FT_Done_MM_Var
>
For comparison, on the same machine, nut using system's R:
charpent@zen-book-flip:/usr/local/sage-8$ R
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R est un logiciel libre livré sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de détails.
R est un projet collaboratif avec de nombreux contributeurs.
Tapez 'contributors()' pour plus d'information et
'citation()' pour la façon de le citer dans les publications.
Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.
> capabilities()
jpeg png tiff tcltk X11 aqua
TRUE TRUE TRUE TRUE TRUE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE TRUE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE TRUE TRUE TRUE TRUE TRUE
>
Therefore, I think that this is a distinct issue.
Have you tried reinstalling Cairo into Sage's R?
Replying to @dimpase:
Have you tried reinstalling Cairo into Sage's R?
No such bloody luck:
> install.packages("Cairo")
--- SVP sélectionner un miroir CRAN pour cette session ---
Secure CRAN mirrors
1: 0-Cloud [https] 2: Algeria [https]
3: Australia (Canberra) [https] 4: Australia (Melbourne 1) [https]
5: Australia (Melbourne 2) [https] 6: Australia (Perth) [https]
7: Austria [https] 8: Belgium (Ghent) [https]
9: Brazil (PR) [https] 10: Brazil (RJ) [https]
11: Brazil (SP 1) [https] 12: Brazil (SP 2) [https]
13: Bulgaria [https] 14: Chile 1 [https]
15: Chile 2 [https] 16: China (Hong Kong) [https]
17: China (Guangzhou) [https] 18: China (Lanzhou) [https]
19: China (Shanghai 1) [https] 20: China (Shanghai 2) [https]
21: Colombia (Cali) [https] 22: Czech Republic [https]
23: Denmark [https] 24: East Asia [https]
25: Ecuador (Cuenca) [https] 26: Ecuador (Quito) [https]
27: Estonia [https] 28: France (Lyon 1) [https]
29: France (Lyon 2) [https] 30: France (Marseille) [https]
31: France (Montpellier) [https] 32: France (Paris 2) [https]
33: Germany (Erlangen) [https] 34: Germany (Göttingen) [https]
35: Germany (Münster) [https] 36: Greece [https]
37: Iceland [https] 38: India [https]
39: Indonesia (Jakarta) [https] 40: Ireland [https]
41: Italy (Padua) [https] 42: Japan (Tokyo) [https]
43: Japan (Yonezawa) [https] 44: Korea (Busan) [https]
45: Korea (Gyeongsan-si) [https] 46: Korea (Seoul 1) [https]
47: Korea (Ulsan) [https] 48: Malaysia [https]
49: Mexico (Mexico City) [https] 50: Norway [https]
51: Philippines [https] 52: Serbia [https]
53: Spain (A Coruña) [https] 54: Spain (Madrid) [https]
55: Sweden [https] 56: Switzerland [https]
57: Turkey (Denizli) [https] 58: Turkey (Mersin) [https]
59: UK (Bristol) [https] 60: UK (London 1) [https]
61: USA (CA 1) [https] 62: USA (IA) [https]
63: USA (KS) [https] 64: USA (MI 1) [https]
65: USA (OR) [https] 66: USA (TN) [https]
67: USA (TX 1) [https] 68: Uruguay [https]
69: (other mirrors)
Selection: 32
essai de l'URL 'https://cran.univ-paris1.fr/src/contrib/Cairo_1.5-9.tar.gz'
Content type 'application/x-gzip' length 86982 bytes (84 KB)
==================================================
downloaded 84 KB
* installing *source* package ‘Cairo’ ...
** package ‘Cairo’ correctement décompressé et sommes MD5 vérifiées
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pkg-config... /usr/local/sage-8/local/bin/pkg-config
checking whether pkg-config knows about cairo... yes
checking for configurable backends... cairo cairo-ft cairo-pdf cairo-png cairo-ps cairo-xlib cairo-xlib-xrender
configure: CAIRO_CFLAGS=-I/usr/local/sage-8/local/include -I/usr/local/sage-8/local/include/freetype2 -I/usr/local/sage-8/local/include -I/usr/local/sage-8/local/include/libpng16 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid
checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-L/usr/local/sage-8/local/lib -lfreetype -lz -lpng16 -lz -lcairo -lXext -lXrender -lX11
checking for library containing deflate... no
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/usr/local/sage-8/local/lib/R/library/Cairo’
Les packages source téléchargés sont dans
‘/tmp/Rtmp5RTdn4/downloaded_packages’
Warning message:
In install.packages("Cairo") :
l'installation du package ‘Cairo’ a eu un statut de sortie non nul
>
Same as before...
Description changed:
---
+++
@@ -1,4 +1,4 @@
-Seen in 8.7.beta1, but probably from 8.6 (i. e. the switch to using th library):
+On a Debian `buster` machine, seen in 8.7.beta1, but probably from 8.6 (i. e. the switch to using th library):
capabilities() @@ -12,4 +12,6 @@
Similarly, one can't install the R package "Cairo". This entails the loss of creating graphics files from R, which is exceedingly annoying...
+It should be noted that the problem cannot be reproduced on a Debian stretch
machine.
+
One of the strengths of R being its graphical abilities, losing them is, IMNSHO, a critical problem.
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details.
ERROR: configuration failed for package ‘Cairo’
and what's in this config.log?
Description changed:
---
+++
@@ -1,4 +1,4 @@
-On a Debian `buster` machine, seen in 8.7.beta1, but probably from 8.6 (i. e. the switch to using th library):
+Seen in 8.7.beta1, but probably from 8.6 (i. e. the switch to using th library):
capabilities() @@ -12,6 +12,4 @@
Similarly, one can't install the R package "Cairo". This entails the loss of creating graphics files from R, which is exceedingly annoying...
stretch
machine.One of the strengths of R being its graphical abilities, losing them is, IMNSHO, a critical problem.
Replying to @dimpase:
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details. ERROR: configuration failed for package ‘Cairo’
and what's in this config.log?
This is deleted by R's mechanism :-(. I do not know how to keep the intermediate files).
But I think that the problem exists before Cairo attempts : I should get png(), tiff() and jpeg() at the very minimum...
Replying to @EmmanuelCharpentier:
Replying to @dimpase:
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details. ERROR: configuration failed for package ‘Cairo’
and what's in this config.log?
This is deleted by R's mechanism :-(. I do not know how to keep the intermediate files).
But I think that the problem exists before Cairo attempts : I should get png(), tiff() and jpeg() at the very minimum... without cairo !
Configuration log of an attempt to manually install Cairo
Attachment: config.log
Replying to @dimpase:
checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details. ERROR: configuration failed for package ‘Cairo’
and what's in this config.log?
Found how to do that : you have to manually download the tarball, untar it and R CMD INSTAZLL Cairo
.
See attachment (pretty uninformative...).
I'm not exactly sure what you expect here.
As with Python, what capabilities get build when you configure and build R is going to depend heavily on what system packages you have installed (and most likely their -devel counterparts), and whether or not the versions of those packages are supported for building whatever feature you care about. I don't think Sage includes SPKGs for all the potential dependencies for something like R (e.g. Cairo).
I don't think this has anything to do either way with the use of rpy2 to access the R interpreter.
Replying to @dimpase:
I am inclined to close this as worksforme. I think the best way to proceed is to add capability to use system R installation, via adding appropriate
spkg-configure.m4
tobuild/pkgs/r
.
+1
One thing this will probably have to do (which I don't think any of our other spkg-configure.m4
files do yet, though it's certainly a possibility I've considered) is output a file containing the results of its findings; for example, the path to the system R. This would need to be output to a file that can be read by the Sage sources, or possibly even just a variable added to the existing src/bin/sage-env-config.in
.
(Though I also think, in the spirit of #27040, there should be some kind of src/sage/env_config.py.in
which results in a src/sage/env_config.py
which is imported by sage.env
to add additional package data that can be used by sagelib without first having to source some environment variables.)
Somewhere around line 350 of the log you will a compiler/linker call, and the code it is called on. And the error libcairo.so.2: undefined symbol: FT_Done_MM_Var
- same as in the comment 2 above.
The reason is that libfreetype shipped with Sage is older (2.8) than the one on your system (2.9), and it does not even have FT_Done_MM_Var
, whereas cairo expects it to be available.
So the wrong library is pulled in, resulting in this error.
For instance, upgrading freetype to version 2.9.1 should fix this, at least on buster.
Whether such an upgrade will break cairo on older systems, is a question I don't know the answer to.
It could also be an R or Cairo bug, I don't know.
For sure this has absolutely nothing to do with rpy2.
libfreetype is another one that should be high priority to get an spkg-configure.m4
. This is not the first time I've encountered an incompatibility with it over that exact same symbol, though I forget the rest of the context.
I'd also say the freetype upgrade should include spkg-configure.m4
to pull in the system library if one is available - this would preclude this sort of mess we see here, that comes from duplicate libs being pulled from different places...
See #27168 for a followup.
Replying to @embray:
libfreetype is another one that should be high priority to get an
spkg-configure.m4
. This is not the first time I've encountered an incompatibility with it over that exact same symbol, though I forget the rest of the context.
I've beaten you to opening #27168 :-)
Meanwhile I opened #27169 to upgrade to freetype 2.9.1. Will post a branch soon.
Note that #27040 was initially opened as "R 3.4.2 has no graphics capabilities" and its summary was later changed to "Upgrade freetype to 2.8.1".
Please check if upgrading to freetype 2.9.1 (#27169) fixes the problem described here.
==>positive_review
with a invalid/duplicate/wontfix
milestone.
Reviewer: Emmanuel Charpentier
Presuming these are all correctly reviewed as either duplicate, invalid, or wontfix.
Seen in 8.7.beta1, but probably from 8.6 (i. e. the switch to using th library):
Similarly, one can't install the R package "Cairo". This entails the loss of creating graphics files from R, which is exceedingly annoying...
One of the strengths of R being its graphical abilities, losing them is, IMNSHO, a critical problem.
CC: @timokau @dimpase @embray @slel
Component: packages: standard
Reviewer: Emmanuel Charpentier
Issue created by migration from https://trac.sagemath.org/ticket/27163