Installing rpy2 to work with R 3.4.0 on OSX - r

I would like to use some R packages requiring R version 3.4 and above. I want to access these packages in python (3.6.1) through rpy2 (2.8).
I have R version 3.4 installed, and it is located in /Library/Frameworks/R.framework/Resources However, when I use pip3 install rpy2 to install and use the python 3.6.1 in /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6) as my interpreter, I get the error:
Traceback (most recent call last):
File "/Users/vincentliu/PycharmProjects/magic/rpy2tester.py", line 1, in
from rpy2 import robjects
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/robjects/init.py", line 16, in
import rpy2.rinterface as rinterface
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/init.py", line 92, in
from rpy2.rinterface._rinterface import (baseenv,
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/_rinterface.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libiconv.2.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/_rinterface.cpython-36m-darwin.so
Reason: Incompatible library version: _rinterface.cpython-36m-darwin.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
Which first seemed like a problem caused by Anaconda, and so I remove all Anaconda-related files but the problem persists.
I then uninstalled rpy2, reinstalled Anaconda and used conda install rpy2 to install, which also installs R version 3.3.2 through Anaconda. I can then change the interpreter to /anaconda/bin/python and can use rpy2 fine, but I couldn't use the R packages I care about because they need R version 3.4 and higher. Apparently, the oldest version Anaconda can install is 3.3.2, so is there any way I can use rpy2 with R version 3.4?
I can see two general solutions to this problem. One is to install rpy2 through conda and then somehow change its depending R to the 3.4 one in the system. Another solution is to resolve the error
Incompatible library version: _rinterface.cpython-36m-darwin.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
After much struggling, I've found no good result with either.

I uninstalled rpy2 and reinstalled with --verborse. I then found
ld: warning: ignoring file /opt/local/lib/libpcre.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libpcre.dylib
ld: warning: ignoring file /opt/local/lib/liblzma.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/liblzma.dylib
ld: warning: ignoring file /opt/local/lib/libbz2.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libbz2.dylib
ld: warning: ignoring file /opt/local/lib/libz.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libz.dylib
ld: warning: ignoring file /opt/local/lib/libiconv.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libiconv.dylib
ld: warning: ignoring file /opt/local/lib/libicuuc.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libicuuc.dylib
ld: warning: ignoring file /opt/local/lib/libicui18n.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libicui18n.dylib
ld: warning: ignoring file /opt/local/Library/Frameworks/R.framework/R, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/Library/Frameworks/R.framework/R
So I supposed the reason is the architecture incompatibility of the libiconv in opt/local, causing make to fall back onto the outdate libiconv in usr/lib. This is strange because my machine should be running on x86_64 not i386. I then tried export ARCHFLAGS="-arch x86_64" and reinstalled libiconv using port. This resolved the problem.

I had uninstall the version pip installed and install from source python setup.py install on the download https://bitbucket.org/rpy2/rpy2/downloads/. FWIW not using Anaconda at all either.

Related

Installation of r packages failed with the same error "GLIBCXX_3.4.29' not found"

When I tried to install r package "osmdata" (or any other package) with command
install.packages("osmdata")
it failed with error
"GLIBCXX_3.4.29' not found (required by /home...R/x86_64-unknown-linux-gnu-library/4.2/00LOCK-osmdata/00new/osmdata/libs/osmdata.so)
host system is debian, r is installed using package manager Guix.
The error means: osmdata.so was compiled with g++ version 11.1.0 (ABI mapping of GLIBCXX to g++ version is documented here), but the version of libstdc++.so.6 installed on the system is older, and doesn't provide GLIBCXX_3.4.29.
You need to get a version of osmdata.so appropriate for your system, or you need to build it from source, or you need to update your libstdc++.so.6.
P.S. Your question has nothing to do with glibc.
I solved it by installing package r-guix-install from Guix package manager and using this command
guix.install::guix.install("osmdata")

Error when installing PySide on Nvidia Jetson Nano 4gb

This is the error that shows up when I try to run "pip install PySide" on my Jetson Nano. Can someone please let me know how I can fix this error?
CMake Warning at /usr/share/cmake-3.10/Modules/FindQt4.cmake:620 (message):
/usr/bin/qmake reported QT_INSTALL_LIBS as "/usr/lib/aarch64-linux-gnu" but
QtCore could not be found there. Qt is NOT installed correctly for the
target build environment.
Call Stack (most recent call first):
CMakeLists.txt:9 (find_package)
-- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython2.7.so (found suitable version "2.7.17", minimum required is "2.6")
-- Found LibXml2: /usr/lib/aarch64-linux-gnu/libxml2.so (found suitable version "2.9.4", minimum required is "2.6.32")
-- Could NOT find LibXslt (missing: LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) (Required is at least version "1.1.19")
Qt QTGUI library not found.
Qt QTXML library not found.
Qt QTCORE library not found.
CMake Error at ApiExtractor/CMakeLists.txt:82 (qt4_add_resources):
Unknown CMake command "qt4_add_resources".
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-build-mimaL7/PySide/pyside_build/py2.7-qt4.8.7-64bit-release/shiboken/CMakeFiles/CMakeOutput.log".
error: Error configuring shiboken
PySide does not have official release package for ARM systems. You have to build it yourself. All I can afford is this .whl, but keep in mind that it was built on Ubuntu 20.04 with JetPack 4 and Python 3.6 on board.

Failed installing OpenCV using RStudio

I tried installing OpenCV using Rstudio (R version 3.6.3). I installed both Rtools and CMake and added them to the PATH. I received following error:
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:106 (enable_language):
The CMAKE_CXX_COMPILER:
c:/Rtools/mingw32/bin/g++.exe
is not a full path to an existing compiler tool.
Please help.

Error: package or namespace load failed for 'RevoUtilsMath'

I'm getting a little bit crazy with this issue. I'm trying to install an R package using conda in my environment (python 2.7) in my home on a cluster (i.e. without root permissions). I firstly installed R in my env using:
conda install -c r r=3.4
Then:
conda install -c conda-forge python-igraph
(because igraph is required by my library of interest)
and finally:
conda install -c conda-forge r-diffusionmap
Unfortunately when I launch R the following message appears:
Error: package or namespace load failed for 'RevoUtilsMath': .onLoad
failed in loadNamespace() for 'RevoUtilsMath', details: call: NULL
error: Remove Microsoft R and then re-install. Be sure to select MKL
libraries as an install option.
During startup - Warning message:
package 'RevoUtils' was built under R version 3.4.3
What does it mean? How can I solve this?
Thank you in advance
I had this same issue after I installed some libraries (Rcpp included) in my root R, but not my conda environment (which screwed up conda). This would cause kernel death anytime a jupyter notebook running R was even opened.
The fix for me was:
Uninstall Anaconda3
Reinstall Anaconda3
Reinstall all the libraries I needed (mostly just Bioconductor in R)
A few other issues popped up, like package inconsistencies, but I dealt with those as described here.
All R packages on conda-forge (or Bioconda) are compiled against one single version or R for each new release branch (usually starting from patch 1, so 3.x.1, except for 3.4.3). This is due to ABI incompatibility problems.
Also note that defaults and conda-forge channels are (where) not binary compatible (although now they should be). And that since 2018 the default anaconda channel is distributing Microsoft R Open as default R, whether all packages from conda-forge should be preferably used with R from conda-forge.
You should be able to solve this issue by installing R using conda install -c conda-forge r-base.
the same error information for me when I open R for run code in ubuntu platform(18.4), and there is no other useful methods to solve it.My R version is 3.4.3.enter image description here

R can't install devtools or git2r due to lack of zlib on macOS 10.12.3 and 10.12.5

I am trying to install two packages in R (3.3.2): devtools and git2r. They are depending on the existence of zlib. This comes with macOS Sierra (10.12.3) and it's version 1.2.8 by default.
When I'm trying to install these packages I get the error below.
I've been trying a lot of things.
directly installing via CRAN in RStudio: no effect.
trying to locate zlib on macOS: can't find zlib.
installing via R CMD INSTALL git2r: no effect.
I notice someone has a similar issue posted on GitHub: https://github.com/ropensci/git2r/issues. There is no solution yet.
Does anyone here have an idea?
Thanks!
Sander
ERROR MESSAGE BELOW
configure error in "/private/tmp/RtmpP6HZFx/R.INSTALLe73412909267/git2r"
configure error
The zlib library that is required to build git2r was not found.
Please install:
zlib1g-dev (package on e.g. Debian and Ubuntu)
zlib-devel (package on e.g. Fedora, CentOS and RHEL)
and try again.
If the zlib library is installed on your system but the git2r configuration is unable to find it, you can specify the include and lib path to zlib with:
"R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r"
See "config.log" for more details
ERROR: configuration failed for package "git2r"
*removing "/usr/local/lib/R/3.3/site-library/git2r"
UPDATE: the same issue persists on macOS X 10.12.5 in combination with R 3.4.0 - the latter I need for DESeq2.
Solution...Mmm. Not really. I simply uninstalled R and all the packages, and than I reinstalled everything again. I installed R and RStudio via homebrew, following the instructions here: https://rud.is/b/2015/10/22/installing-r-on-os-x-100-homebrew-edition/.
Oddly enough: all issues disappeared.
UPDATE #1: this solution does not - obviously - work for the combination R 3.4.0 and macOS X 10.12.5. We need a solution for this issue.
UPDATE #2: I have discovered what I believe was the issue: a wrong path to the xcode command line tools.
sudo xcode-select --reset did the trick and now xcode-select -p points to /Library/Developer/CommandLineTools. And which xcode-select points to /usr/bin/xcode-select. Googling I discovered that it is not needed to install Xcode through the App Store as it states on http://railsapps.github.io/xcode-command-line-tools.html:
"On earlier versions of macOS, it was more difficult to install Xcode Command Line Tools. It required a huge download of the full Xcode package from the Mac App Store or registration as an Apple developer for a smaller Command Line Tools package. Mac OS X Mavericks made installation of Xcode Command Line Tools much simpler.".
i was having the same problem. i have a note 8(samsung). just go to GitHub and install zlib from there.

Resources