Incompatible library version: libtk8.6.dylib requires ... when installing R package - r

I'm trying to install the R package ggplot2, though the error that I am getting seems unrelated to that specific package. I am running on Mac OSX 10.6.8. The error message is at the bottom of this message. What happened was:
I opened up R and typed install.packages("ggplot2"). After typing this, an X11 window opened saying that I should update to the latest version of X11. I clicked through and updated X11. The install went through fine, ending with a big green check mark.
Then, I thought, "let me check if R is up to date as well, as the ggplot documentation suggests updating R before installing ggplot". So I opened up R, and clicked "check for updates". Lo and behold! an update appeared. I downloaded and installed the update. The install went through fine, ending with a big green check mark.
When I opened R, I typed install.packages("ggplot2") and I got the message below:
> install.packages("ggplot2");
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so, 10):
Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/local/lib/libtk8.6.dylib
Reason: Incompatible library version: libtk8.6.dylib requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0
Your help is greatly appreciated. Thanks.

Try installing the latest version of XQuartz. It worked for me.

Related

R: install uroot package in ubuntu

I am trying to install the forecast package which depends on uroot, which apparently have been written to require a GPU?
install.packages("uroot") yields the following error. Has anyone found this issue and may suggest a work around? I am using ubuntu 16.04.
I have the file in question located here: /usr/local/cuda-8.0/ and I added to my path export PATH=/usr/local/cuda-8.0/:$PATH
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.2/uroot/libs/uroot.so':
libcudart.so.8.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.2/uroot’
Warning in install.packages :
installation of package ‘uroot’ had non-zero exit status
Just in case this is useful for someone, I stumbled with the same problem trying to install "imputeTS" with R version 3.5.1 on Fedora 27 with CUDA 10.0 correctly installed an setted in PATH.
for me it just happened that I was running install.package("imputeTS") (which depends on forecast) in a R console as root, installing the packages to the user home solved the problem. It's seems that the libraries are searched in different places according to the user running the script, it's important to note that.
I just migrated to Linux. On an Ubuntu 18.04 setup, using install.packages with dependencies set to TRUE succeeded with no complaints. (No GPU on mu box.)
install.packages("forecast", dep=TRUE)
# there are quite a few dependencies and you happened to be missing one
packageDescription()
#-----------includes this line----------
Imports: colorspace, fracdiff, ggplot2 (>= 2.2.1), graphics, lmtest,
magrittr, nnet, parallel, Rcpp (>= 0.11.0), stats,
timeDate, tseries, urca, uroot, zoo
You can try to modify file "/etc/rstudio/rserver.conf", add "LD_LIBRARY_PATH" env, like:
rsession-ld-library-path=/usr/local/cuda/lib64
Actually, When you open session of "RStudio Server" from browser, the session does't get env from the ".bashrc".

rJava doesn't load in R 3.4.2 and MacOS Sierra 10.12.6

Here's the error I get:
> library(rJava)
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
I see this is by no means a unique problem.. I've tried the solutions here, here and here. No success.
Some more details: I'm using R GUI, but I also can't load rJava through R terminal. I also didn't have any issue with rJava on R 3.3.s
You have two options here:
get older release of R and use precompiled version of rJava
get rJava sources and compile it for yourself
Note that rJava (most recent sources) require some features that are not embedded inside XCode and clang that is available via AppStore. You will need to do some low level stuff when it comes to building rJava package.
You can find detailed instruction here: http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/
If you decide to use older release of R, it's still a struggle to get it working, but way less to do: http://www.owsiak.org/r-java-rjava-and-macos-adventures/
JAVA_HOME path is different for different version of MAC OS.
In some cases there is /jre folder and in some cases it is not after /Home director manually go towards /server folder with CD command in terminal and using pwd copy the entire path use that to set the java.home then you can easily load rJava library. This is how I was able to fix the issue
options("java.home"="/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib")
Sys.setenv(LD_LIBRARY_PATH='$JAVA_HOME/server')
dyn.load('/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib/server/libjvm.dylib')
library(rJava)

R version 3.4.0 rgdal will not load

I recently installed the latest version of R (3.4.0) and installed all of my packages, but for some reason rgdal will not load and I'm getting this message:
library(rgdal)
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgdal/libs/rgdal.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgdal/libs/rgdal.so, 6): Library not loaded: /Builds/unix/recipes/build/gdal-2.1.3-obj/libgdal.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgdal/libs/rgdal.so
Reason: image not found
I went to the rgdal/libs directory and the rgdal.so file exists, but for some reason doesn't want to load. Anyone else have this issue or a similar one?
Try installing RStudio and re-download it from there or type install.packages("rgdal"). If none of these work try installing another package and see if you can run it, because it is either the directory, the package or the version of the package is not compatible with the version of the language.
Do you have GDAL OS X frameworks installed? If not, go to William Kyngesburye's site, download and install frameworks in the following order:
GDAL Complete
GSL Framework
FreeType
cairo
After completing this installation, go for steps 2 and 3 of this answer, and then, install rgdal from R.app using these specifications in the install.packages command.
It solved the problem for me, hope it helps you!
Seems to be related to my issue posted same day, Unable to load pgirmess library ("image not found") - R 3.4 in Mac OS .
I installed the previous version of R from CRAN (3.3.3), and it works fine. You can have both versions installed at the same time. Maybe not a long term solution but at least a temporary fix so your work can continue.

Installing & using the asbio package under OS X

I'm a TA in a statistics class, and the students are supposed to use the "asbio" package in r for multiple comparisons. Some of those who have OSX are complaining that asbio will not load. I cannot reproduce the error on my own mac.
Here are the errors one of the students is seeing:
>library(asbio)
Loading required package: tcltk
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
Error: package ‘tcltk’ could not be loaded
> install.packages("tcltk")
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.1.1)
Here are a few things students have tried:
install tcltk2: "It works now, but I still get errors" (Sorry, I know that's a confusing answer, but it's what I have)
install xquartz: "Now it works."
I suspect that xquartz is the right answer here, but if anybody could explain what's going on and confirm, that would be awesome.
(And why the ^& would a numerical statistics package need tcl/tk anyway???)
tcl/tk needs an X11 environment to work in for graphical output and Apple no longer ships an X11 environment with their operating system. XQuartz fills that gap, but is a separate install. Said install makes the X11 libraries available (look at the missing libraries in your errors) and those libraries—in turn—make graphical operations with tcl/tk possible.
the absio package has functions that let you do animation (like anim.ci) which rely on the graphics capabilities of tcl/tk.
A student in the class posted the following instructions:
1) Install xquartz. You don't need to click it ever again after installing it.
2) Restart computer.
3) Open Rstudio (or whatever R). Run library(tcltk). Don't use require or install.packages for it. Computer should now open up xquartz on its own.
4) Run install.packages("asbio")
5) library(asbio)
6) You should be able to run pairw.anova.
(I'm still waiting to see if the student wants credit by name here, but in any case, I'm thankful to them.)

Error when including the zoo package in R

When I tried to include the zoo package, I received the following error information:
> library(zoo)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
'/Users/zhangfan/Library/R/2.13/library/zoo/libs/i386/zoo.so':
dlopen(/Users/zhangfan/Library/R/2.13/library/zoo/libs/i386/zoo.so, 6):
Library not loaded: #rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
Referenced from: /Users/zhangfan/Library/R/2.13/library/zoo/libs/i386/zoo.so
Reason: image not found
Error: package/namespace load failed for 'zoo'
Could anyone explain what that means?
Thanks a lot!
I had the same error after trying to install zoo recently. I fixed it by installing from source.
install.packages("zoo", type="source", repos="http://cran.stat.ucla.edu/")
That looks a whole lot like the errors that Mac /User/'s were getting last week with the new GUI R.app that went along with R 2.14.0. Simon Urbanek fixed it several days ago, if those details fit your situation the first thing to try would be to install the new GUI from either CRAN or http://r.research.att.com/
If ion the other hand you are trying to install the new zoo-package from CRAN while running R 2.13.x you might want to upgrade R (at the same locations) to prevent major version mismatch.

Resources