R on ubuntu 16: unable to load shared object, undefined symbol: gotoblas - r

I am on the Amazon Deep Learning AMI image trying to use R.
$ which R returns
/usr/bin/R
$ R returns
/usr/lib/R/bin/exec/R: symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: gotoblas
sudo update-alternatives --config libblas.so.3 returns 4 possible selections:
/usr/lib/openblas-base/libblas.so.3, /usr/lib/atlas-base/atlas/libblas.so.3, /usr/lib/libblas/libblas.so.3 and /usr/lib/openblas-base/libblas.so.3
By selecting option 2 I can get into the R repl. However, I receieve the following warning:
unable to load shared object '/usr/lib/R/library/stats/libs/stats.so':
/usr/lib/liblapack.so.3: undefined symbol: gotoblas
This same error causes package installations to fail.
Any help would be greatly appreciated.

Fixed! I followed this post and used sudo update-alternatives --config liblapack.so.3 to switch to the correct BLAS version.

Related

Cannot install any R package

I'm on Ubuntu 20.04. R version 4.0.2.
I've been using R for a long time and everything worked fine.
Today, when trying to install new packages i get this error:
** checking absolute paths in shared objects and dynamic libraries
readelf: symbol lookup error: readelf: undefined symbol: ctf_arc_bufopen, version LIBCTF_1.0
Error in system(paste("readelf -d", shQuote(l)), intern = TRUE) :
error in running command
I tried to delete and reinstall R and all the packages, but now the same thing happens also for packages that were previously installed. So i think that the problem is not caused by R itself.
I havent done any R update recently.
First of all, thank you very much Chris for hinting at the problem. It was actually ctf-suite related.
When doing grep libctf* it returned:
ii libctf0:amd64 2.35.1-1ubuntu1
amd64 Compact C Type Format library (runtime, BFD dependency)
So I tried:
sudo apt-get install libctf-nobfd0
and it actually solved the problem.
I managed to install all the needed packages.

Initial Rattle issues (Os) "Error: -with-x11" & "Error: gtk+ 2.24.32 did not build"

I have been trying to install Rattle on my Os into my R using this instructions:
https://zhiyzuo.github.io/installation-rattle/
I get to Line 7 and input
~$ brew install --with-x11 cairo
and then get
Updating Homebrew...
Usage: brew install [options] formula|cask
Install a formula or cask. Additional options specific to a formula may be
appended to the command.
Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the installed formulae or, every 30 days, for all formulae.
...
**Error: invalid option: --with-x11**'''
Ive tried to continue on installing Cairo without the "--with-x11" (as been suggested they no longer support that).
So I did just "brew install cairo" that worked.
I go to line 9 Now we can install gtk+ by:
~$ brew install --build-from-source --verbose gtk+
And I get:
**Error: gtk+ 2.24.32 did not build
Logs:
/Library/Logs/Homebrew/gtk+/00.options.out
/Library/Logs/Homebrew/gtk+/01.configure.cc
/Library/Logs/Homebrew/gtk+/config.log
/Library/Logs/Homebrew/gtk+/01.configure
READ THIS: https://docs.brew.sh/Troubleshooting'''
If this helps in the last part I see in the terminal things saying:
==> ./configure --disable-dependency-tracking --disable-silent-rules - -prefix=/usr/local/Cellar/gtk+/2.24.32_3 --disable-glibtest --enable-introspection=yes --with-gdktarget=x11 --enable-x11-backend
configure: WARNING: unrecognized options: --enable-x11-backend
and
configure: error: Package requirements (cairo-xlib >= 1.6) were not met:
No package 'cairo-xlib' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables CAIRO_BACKEND_CFLAGS
and CAIRO_BACKEND_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Anyone have any suggestions for this ?
Thanks.

Error when install.package("ggiraph"): "no matching function for call to ‘regex_replace" / RStudio on AWS-Cloud Linux

I'm having this error when trying to install ggiraph in R (RStudio Server on an linux based AWS instance, new RStudio and R versions).
Can't find any advice anywhere for linux systems (only for OS X).
Did anybody encounter the same problem and how did you solve it?
Thank you!
Error message:
dsvg.cpp: In function ‘std::string compile_css(const string&, const char*, const string&, const char*, const char*, const char*)’:
dsvg.cpp:725:46: error: no matching function for call to ‘regex_replace(const char*&, std::regex&, std::string&)’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:725:46: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex<char>’ and ‘std::basic_string<char>’)
return std::regex_replace(css, pattern, cls);
^
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(const basic_string<_Ch_type>& __s,
^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char*’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:726:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
...
^
make: *** [dsvg.o] Error 1
ERROR: compilation failed for package ‘ggiraph’
removing ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
restoring previous ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
Error: Failed to install 'ggiraph' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpU8zekV/file485f57d349a8/ggiraph_0.7.9.tar.gz’ had non-zero exit status
In my case for this problem, my solution is update the linux GCC version.
Type the script on your terminal to update GCC.
gcc -v ## to check your gcc version(original centos 7 seems 2.5.4)
and refer to this article to update the developer tool 8 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
On CentOS, install package centos-release-scl available in CentOS repository:
sudo yum install centos-release-scl
On RHEL, enable RHSCL repository for you system:
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
Install the collection:
sudo yum install devtoolset-8
Start using software collections:
scl enable devtoolset-8 bash
Check your GCC version is latest:
gcc -v #### Now GCC version should be 8.3.1 20190311
Into the R to install ggiraph on terminal:
sudo R
Install the ggiraph package:
install.packages('ggiraph', repos='http://cran.us.r-project.org')
Quit the terminal R
q() # type "n" to not save workspace image
And switch to rstudio console, library the ggiraph package
library(ggiraph)
All ggiraph function are able to work now! :D

Installing XGBoost GPU for R on Ubuntu AMI

I'm on the AWS deeplearning Ubuntu AMI trying to install the XGboost GPU version R package using the instructions here: http://xgboost.readthedocs.io/en/latest/build.html#building-with-gpu-support
I've cloned the repo, made a new build dir and then executed:
cmake .. -DUSE_CUDA=ON -DR_LIB=ON
The error:
/usr/lib/R/bin/exec/R: symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: gotoblas
/usr/lib/R/bin/exec/R: symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: gotoblas
/usr/lib/R/bin/exec/R: symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: gotoblas
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find LibR (missing: LIBR_HOME LIBR_INCLUDE_DIRS LIBR_LIB_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindLibR.cmake:173 (find_package_handle_standard_args)
CMakeLists.txt:165 (find_package)
I believe this is due to the libblas.so.3 file living in /home/ubuntu/src/OpenBLAS instead of a more standard location. Just need a little nudge to bridge my lack of linux env variable knowledge and connect the two. Thanks!
You can try to create symbolic link from the expected location to the actual location of the shared library file or the directory which contains the expected shared library file to get around the problem.

Errors building R-packages for conda

I am having a tough time installing R-packages that are not available in the Anaconda repositories. My attempts so far can be found here How to install R-packages not in the conda repositories?.
Currently, I am trying to build the R-package rafalib for conda by following the instructions from this article under the heading Building a conda R package.
The first part works fine.
conda skeleton cran rafalib
Out:
Tip: install CacheControl to cache the CRAN metadata
Fetching metadata from http://cran.r-project.org/
Writing recipe for rafalib
Done
The build command runs into errors
conda build r-rafalib
Out:
Removing old build environment
Removing old work directory
BUILD START: r-rafalib-1.0.0-r3.2.2_0
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ......
Solving package specifications: .
Error: Packages missing in current linux-64 channels:
- r 3.2.2*
- r-rcolorbrewer
I have r 3.2.2-64bit installed via conda and it runs without problems. I also already have r-colorbrewer installed via conda and I can use that package without issues in R. Why am I getting these errors when trying to build a conda package?
I am on Linux (Antergos, an Arch derivative) with kernel 4.4.5-1-ARCH.
UPDATE 2015/04/19
Thanks to this answer, I found out that I could include the dependencies by building them separately in the same directory as the package I want to install. That didn't work for me, but I also read that I can include a channel in the build command with -c, just as when installing. So now I do:
conda build -c r r-rafalib
This gets passed all the dependency problems, but after fetching, extracting and linking packages, it fails. Here is the end of the error message.
Removing old work directory
Source cache directory is: /home/joel/anaconda2/conda-bld/src_cache
Downloading source to cache: rafalib_1.0.0.tar.gz
Downloading http://cran.r-project.org/src/contrib/rafalib_1.0.0.tar.gz
rafalib_1.0.0. 100% |#######################| Time: 0:00:00 4.87 MB/s
Success
Extracting download
Package: r-rafalib-1.0.0-r3.2.2_0
source tree in: /home/joel/anaconda2/conda-bld/work/rafalib
+ mv DESCRIPTION DESCRIPTION.old
+ grep -v '^Priority: ' DESCRIPTION.old
+ /home/joel/anaconda2/envs/_build/bin/R CMD INSTALL --build .
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Command failed: /bin/bash -x -e /home/joel/drafts/r-rafalib/build.sh
The error sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook is the same as I encounter when using install.packages() as reported here.
There is some related discussion in this thread. I have tried to get around this error by installing different versions of ncurses, including this patched version, and I have tried to link the readline libraries, as suggested here, but I keep running into the same error. I'm quite lost at this point and any help to solve this would be greatly appreciated.
Although I started out with a different problem, the final solution turned out to be the same as I posted elsewhere How to install R-packages not in the conda repositories?. I am adding it here for completeness.
In the end, I got around the rl_event_hookproblems by following the approach recommended here and symlinking anaconda's libreadline to the system one:
mv ~/anaconda3/lib/libreadline.s.6.2 ~/anaconda3/lib/libreadline.s.6.2.bak
ln -s /usr/lib/libreadline.so.6.3 ~/anaconda3/lib/libreadline.s.6.2
I am still having troubles installing some dependency heavy R-packages due to failure to load shared objects when using install.packages() from withing R. However, simpler packages work fine and I can get most of the dependency heavy packages from anacondas R-repositories.

Resources