I'm encountering problems when I want to export a plot from R into a PNG, using several R packages from the toolshed(s).
This problem is probably related to the following issue: http://dev.list.galaxyproject.org/package-r-xx-problem-X11-is-not-available-td4663344.html
Therefore, I'm using the package: http://testtoolshed.g2.bx.psu.edu/view/iuc/package_r_3_0_2
When I run R code of the following structure:
png(output_PValue_distribution_plot) plot(x_var,y_var) dev.off()
R crashes with the following error:
Error in .External2(C_X11, paste("png::", filename, sep = ""), g$width, : unable to start device PNG Calls: png In addition: Warning message: In png(output_PValue_distribution_plot) : unable to open connection to X11 display '' Execution halted
How I interpret this is that in order to produce PNG's, R needs to be compiled with the X11 library.
Because the installer from the toolshed uses the compilation argument " --without-x", it doesn't compile with X11 and so it is not possible to produce PNGs, correct?
I also tried another solution; installation of R with X from the following repository: https://testtoolshed.g2.bx.psu.edu/repository?repository_id=5f7d83aa4f577607 . However, the repository requires several other dependencies which are not programmed within the installer: libx11-dev libxt-dev (and some more, because after all it still work out).
So, what would be the best way to create a PNG figure from my plot(s) within an R instance from a toolshed?
Does it require R to be compiled with X11 or are there ways to overcome this (I am not sure but I thought I read something about Cairo)?
Or would somebody recommend to use a non-R program to convert from e.g. PDF/SVG to PNG? I think this is awckward since R should be the perfect tool to produce PNG figures.
Thanks in advance,
Thanks for the fast response. On a ubuntu server (12.04.04 LTS) I get the following error:
On my 14.04.01 LTS Desktop instance I get another error related to the missing libgfortran.so.1:
This file "libgfortran.so.1" is located in "/home/youri/galaxy/tool-dependencies/R/3.1.0/iuc/package_r_3_1_0/a6cc7706ea14/lib"
Ah. Thanks for the update.
ok - that particular package is supplied with all the dependencies compiled in - so there's something odd going on.
Are you reporting failures from your own Galaxy R/graphics tool which specifies that R310 package as a dependency?
If you are trying to test that package R binary outside the Galaxy tool dependency environment then the various env.sh files which are sourced to set up the paths (including to gfortran libs) will be missing and it won't work.
Maybe we need to know a little more about how you are trying to use/test it - if it installed without error, then any local tools which depend on it will load the right env.sh and it should work!
I did it both ways and got the same error:
- via linking the repository of R310 and running an analysis
- by just running the "env.sh" script in terminal (as shown in the previeous post) and subsequently calling R
Both have problems with linking the gfortran link library. If I find some time I will double check whether I made some errors, but I doubt it because I've been playing with it for quite some time. Also adding the directory where the file is located "/home/youri/galaxy/tool-dependencies/R/3.1.0/iuc/package_r_3_1_0/a6cc7706ea14/lib" to the env variables, did not solve the issue.
The installation finished correctly, but the R binary can not find the files (both from commandline as from Galaxy)
I was able to reproduce this error, and determined that the tarball referenced by the tool dependency definition was missing a symbolic link to the gfortran library in the right place for $INSTALL_DIR/lib/R/bin/exec/R to find it. I have created that link and repackaged the tarball. If you go to the installed repository and select the "manage tool dependencies" option, then uninstall and reinstall the R tool dependency, R should run correctly.
Thanks for the fix. The installer issue is indeed fixed. Yet, I still get the X11 error:
I want to recall that also this installer is compiled with the "--without-x" flag, which I expect to be the cause of the problem. If desired, I can test it on multiple machines and I can also test it running from a Galaxy tool although this behavior should not change.
As I mentioned earlier, I partially managed to solve this issue by using the https://testtoolshed.g2.bx.psu.edu/view/joachim-jacob/package_r3_withx repository that is compiled with X11. I say partially because unfortnuately compilation failed on several instances.
As workaround/temporary solution I now create PDF files and I convert it after R with graphicsmagick:
Conversion can be achieved using the commands in the <command></command> tag of the wrappers XML file: