Error install package "kohonen" package for R - r

I tried to install the package "kohonen" and that is the output when trying to lauchn it
> require(kohonen)
Le chargement a nécessité le package : kohonen
Error: package or namespace load failed for ‘kohonen’ in dyn.load(file, DLLpath = DLLpath, ...):
impossible de charger l'objet partagé '/home/sebastien/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so':
~/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so: symbol _ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
I tried to figure out what is going but I didn't find how to fix it. I'm on Ubuntu 14.04
I saw it may be fixed by downgrading gcc to 4.x (maybe 4.2, since the package sucessfully installed on my latpopo with this gcc version)
Current version is:
$ gcc --version
gcc (Homebrew gcc 5.4.0) 5.4.0
I saw you can have several gcc versions installed, but I dont know how to specify the gcc used by R.
EDIT
I tried using gcc 4.8 and R uses it. But it didn't solve my problem...
EDIT 2
It may be due to GLIBCXX_3.4.21 and libstdc++.so.6 with
But I have GLIBCC3.4.21
sebastien#sebastien-LABOFARM-HP-Z640-Workstation:~/.R$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
sebastien#sebastien-LABOFARM-HP-Z640-Workstation:/usr/lib/x86_64-linux-gnu$ ll libstdc*
lrwxrwxrwx 1 root root 19 août 20 21:01 libstdc++.so.6 -> libstdc++.so.6.0.24*
-rwxr-xr-x 1 root root 1114368 août 20 21:15 libstdc++.so.6.0.24*
I finally checked my laptop where the kohonen package works and i found this:
-rwxr-xr-x 1 root wheel 1471104 12 mar 2016 libstdc++.6.0.9.dylib
lrwxr-xr-x 1 root wheel 21 28 oct 2015 libstdc++.6.dylib -> libstdc++.6.0.9.dylib
lrwxr-xr-x 1 root wheel 17 28 oct 2015 libstdc++.dylib -> libstdc++.6.dylib
So basicallyI think my issue is libstdc++ is older so the package won't work.
I have tried to update gcc but it doesn't update libstdc++

Ok now some of my R packages cannot be load any more.
The error is the same; I'm lost

Ok so it seems my last error fix the original errors.
I just deleted every user installed R packages.
And then I reinstall some packages, including kohonen and it works.
Maybe some packages (dependencies from kohonen) were compiled with different gcc version compiler and it brokes everything

Related

Unable to install cubature package (configure: error: C compiler cannot create executables)

I've been trying to install the "statsr" package for the "Stats with R" specialization on coursera, however, I've run into quite a few roadblocks here.
After trying everything suggested on StackOverflow and otherwise, this is where I'm at.
Apparently, I'm unable to install the "curbature" package without which "statsr" wouldn't install.
> install_local("~/Downloads//statsr-master")
Statsr error: https://pastebin.com/8wGequDQ
> install.packages("cubature")
Curbature error : https://pastebin.com/MLb4Dqf3
I have command line tools installed along with clang and gcc. Brew config log shown below :
HOMEBREW_VERSION: 2.0.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 117c24f4b6294e037431d3a850ced6955d53e26f
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 912d73ae0e5e38162e1dce53e5a53bb060d78da8
Core tap last commit: 9 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_LOGS: /Users/shaileshdudala/Library/Logs/Homebrew
CPU: dodeca-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.2
macOS: 10.14-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
Thoughts?
Hey I had the same issue. Uninstalled RStudio from Anaconda, then installed RStudio independently (not through Anaconda) and ran all of the package install commands. Works fine now

Can't get R to recognize installed libgfortran when installing packages

I'm trying to install packages in R that depend on libgfortran, but I keep getting this error:
dyld: Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgfortran.4.dylib
Referenced from: /usr/local/Cellar/r/3.4.3_1/lib/libR.dylib
Reason: image not found
I have gfortran installed through homebrew gcc:
❯❯ readlink `which gfortran`
../Cellar/gcc/8.2.0/bin/gfortran
There's a libgfortran available at /usr/local/opt/gcc/lib/gcc/8/libgfortran.5.dylib, but this is not the one R is looking for. How do I convince R to look for gcc 8 instead of gcc 7?
"How do I convince R to look for gcc 8 instead of gcc 7?"
You should not do that! Those libraries are NOT compatible, that's why soname is changed. The ABI is different. You need the correct version of GCC which was used to compile your R package. See very similar (but Linux) questions and answers like R v3.4.0-2 unable to find libgfortran.so.3 on Arch How to install libgfortran.so.4 on ubuntu 16.06
You really need the compatible library or update your R to a version that uses GCC 8.

On CentOS Linux 7.4, cannot install the R package "httpuv"

I am currently using CentOS Linux 7.4.1708 (Core). I have tried to install the package httpuv in R through various methods to no avail. It always ends with the error:
CC src/unix/libuv_la-procfs-exepath.lo
CC src/unix/libuv_la-proctitle.lo
CC src/unix/libuv_la-sysinfo-loadavg.lo
CC src/unix/libuv_la-sysinfo-memory.lo
CCLD libuv.la
libtool: error: require no space between '-L' and '-L/n/helmod/apps/centos7/Core/pcre/8.37-fasrc02/lib'
make[1]: *** [libuv.la] Error 1
make[1]: Leaving directory `/tmp/Rtmp5Dj7hL/R.INSTALL5c046d96dc92/httpuv/src/libuv'
make: *** [libuv/.libs/libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’
Does anyone have any thought as to what is going on here? Thanks.
The previous answer is partially correct in that it identifies libuv as the missing dependency.
In CentOS 7 you can add this with yum install libuv-devel, then attempt to install the package again with install.packages("httpuv") and provided that was your only issue, it should compile correctly.
The error says that there is a library error in libuv.la.
The cc and CCLD commands show that this is a compilation error - very likely from gcc thrown when trying to compile libuv.la.
In ubuntu linux, I would look in such cases:
$ apt search httpuv
# which gives:
# r-cran-httpuv
R packages with mostly need other system dependencies (libraries outside of R etc) mostly have a package in the apt repository.
Then you do simply:
$ sudo apt install r-cran-httpuv
And then every dependency problems are resolved (though it might be that R asks you to update/upgrade your package after the installation - which sometimes works but sometimes not).
I was looking if CentOS can use apt:
https://everyday-tech.com/apt-get-on-centos/
Another possibility for you would be to use conda which is great to solve such dependency problems. People have then similar to apt prepared for you conda-packages which provide all package dependencies.
$ conda install -c conda-forge r-httpuv
If you don't know conda, I highly recommend you this tutorial:
https://www.youtube.com/watch?v=YJC6ldI3hWk (from Corey Schafer who gives great - mainly Python - tutorials).

R v3.4.0-2 unable to find libgfortran.so.3 Arch

I just got back to working in R on Arch, but got the following error when trying to open R
▶ R
/usr/lib64/R/bin/exec/R: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory
This is my r info
▶ pacman -Qi r
Name : r
Version : 3.4.1-1
Description : Language and environment for statistical computing and graphics
Architecture : x86_64
URL : http://www.r-project.org/
Licenses : GPL
Groups : None
Provides : None
Depends On : blas lapack bzip2 libpng libjpeg libtiff ncurses pcre readline zlib perl gcc-libs libxt libxmu
pango xz desktop-file-utils zip unzip
Optional Deps : tk: tcl/tk interface [installed]
texlive-bin: latex sty files [installed]
gcc-fortran: needed to compile some CRAN packages [installed]
Required By : rstudio-desktop-bin
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 58.13 MiB
Packager : Antonio Rojas <arojas#archlinux.org>
Build Date : Fri 30 Jun 2017 10:45:26 AM PDT
Install Date : Sat 15 Jul 2017 11:47:54 PM PDT
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature
symlink
▶ ls -halt /usr/lib/libgfortran.so.*
-rwxr-xr-x 1 root root 7.1M Jun 30 05:20 /usr/lib/libgfortran.so.4.0.0
lrwxrwxrwx 1 root root 20 Jun 30 05:20 /usr/lib/libgfortran.so.4 -> libgfortran.so.4.0.0
I found the following question R v3.4.0-2 unable to find libgfortran.so.3 on Arch, but I was unable to follow the solution. When a tried to yaourt the r-devel package I was getting package build errors. I also tried to use a different version of gfortran, but ran into problems there. I was wondering if anyone could break the solution to this problem down a little more.
I just had this issue, except my error message was with libgfortran.so.4. There are many ways this error can happen, because there are various packages from AUR which can overwrite a package from the Arch repos. In my specific case, I had overwritten lapack with atlas-lapack.
Here's how I figured that out.
First, I installed pax-utils so that I can have the lddtree tool. Then I ran lddtree /usr/lib64/R/bin/exec/R, which gave me this output:
/usr/lib64/R/bin/exec/R (interpreter => /lib64/ld-linux-x86-64.so.2)
libR.so => /usr/lib/R/lib/libR.so
libblas.so.3 => /lib64/libblas.so.3
libgfortran.so.4 => None
libatlas.so => /lib64/libatlas.so
# etc...
It lookes like libblas.so.3 was the culprit. Next, I ran pacman -Qo /usr/lib/libblas.so.3, which told me /usr/lib/libblas.so.3 is owned by atlas-lapack 3.10.3-1. So, I uninstalled atlas-lapack and rebuilt R again, and it automaically chose lapack from the Arch repos over the atlas version in AUR.
Another possible explanation, in case it happens to someone else than me:
In my case, I didn't overwrite neither blas nor lapack. But the package that I had and who was providing both was openblas-lapack. For some reason, I was encountering the same problem by trying to use python numpy. The solution has been to replace this package by openblas and lapack separately.

Strange includes when compiling httpuv

I'm trying to compile httpuv (latest version from https://github.com/rstudio/httpuv) using R 3.1.1 and Rcpp 0.11.3. However, the compile fails on the following command
g++ -shared -L/usr/local/lib64 -o httpuv.so RcppExports.o filedatasource-unix.o filedatasource-win.o
http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o
websockets-base.o websockets-hixie76.o websockets-hybi03.o
websockets-ietf.o websockets.o Successfully loaded .Rprofile at Mon Mar 2 14:21:42 2015 Goodbye at Mon Mar 2 14:21:42 2015 ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o
For some reason the string "Successfully loaded .Rprofile at Mon Mar 2 14:21:42 2015" is being included in the g++ invocation. I am completely stumped as to where this is coming from.
Does anybody have any pointers?
You seem to have a non-standard ~/.Rprofile or related startup script -- see help(Startup) for the full list.
As the compilation and tests invoke R, you don't want this to get in the way. I do use such script myself, but make sure I protect code by if (interactice()) { ... }.

Resources