[R] Using jpeg() without X

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 28 09:58:51 CEST 2010


On Tue, 27 Jul 2010, mic wrote:

> When I tried this, I'm having this error. Can somebody help me on
> this. Are there any alternatives or workaround for this? I'm having
> hard time to convince our admin to install X11 library and headers
> since they are not included on the default OS installation.

You could install R from an RPM: you only need the X11 headers to 
build R.  (It is possible if tricky to do that in a user account, but 
you might persuade the sysadmin to do so.)

You could use the bitmap() device, if gs is installed.

You could use some of the third-party alternatives (packages Cairo, 
GDD ...) *but* you almost certainly don't have the -devel RPMs they 
depend on either.  (I don't think the -devel RPMs needed for jpeg are 
in 'the default OS installation', but it depends on which default.)

You could install a copy of X11 (and, preferably, cairographics) from 
the sources in your own space.

Finally, you could talk to the 'admin's line-manager about his/her 
employee's obstructive attitude.

>
> Thanks in advance :)
>
>> jpeg("test.jpg")
> Error in jpeg("test.jpg") : X11 is not available
>
>> sessionInfo()
> R version 2.11.1 (2010-05-31)
> i686-pc-linux-gnu
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
> [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>> capabilities()
>    jpeg      png     tiff    tcltk      X11     aqua http/ftp
> sockets
>   FALSE    FALSE    FALSE    FALSE    FALSE    FALSE     TRUE
> TRUE
>  libxml     fifo   cledit    iconv      NLS  profmem    cairo
>    TRUE     TRUE     TRUE     TRUE     TRUE    FALSE    FALSE
>
>
> Seems that libjpeg is available on our server
> [root at localhost R-2.11.1]# locate libjpeg
> /usr/lib/libjpeg.so
> /usr/lib/libjpeg.so.62
> /usr/lib/libjpeg.so.62.0.0

Interesting: the first is in the libjpeg-devel RPM, so the sysadmin 
has installed some unnecessary software already ....

> I'm using Fedora 12 and compiled the newest version of r-project.
> Here are my steps I've taken before I run that command
>
> ./configure --with-x=no --with-tcltk=no
>
> Here's the message after the command...
> R is now configured for i686-pc-linux-gnu
>
>  Source directory:          .
>  Installation directory:    /usr/local
>
>  C compiler:                gcc -std=gnu99  -g -O2
>  Fortran 77 compiler:       gfortran  -g -O2
>
>  C++ compiler:              g++  -g -O2
>  Fortran 90/95 compiler:    gfortran -g -O2
>  Obj-C compiler:
>
>  Interfaces supported:
>  External libraries:        readline
>  Additional capabilities:   JPEG, NLS
>  Options enabled:           shared BLAS, R profiling, Java
>
>  Recommended packages:      yes
> ...
>
> make
> make install
> R
>> jpeg("test.jpg")
> Error in jpeg("test.jpg") : X11 is not available
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list