Installing RSymphony using RStudio on macOS - r

I am trying to install the package RSymphony using RStudio in my MAC (to afterwards be able to install the package fPortfolio). After accepting with "Y" to install the package from the source, I get the message:
> package 'Rsymphony' successfully unpacked and MD5 sums checked
> Cannot find SYMPHONY libraries and headers.
> See <https://projects.coin-or.org/SYMPHONY>.
> ERROR: configuration failed for package 'Rsymphony'
> removing '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rsymphony'
> Warning in install.packages:
> installation of package 'Rsymphony' had non-zero exit status
I tried all the suggestions from other answers in this blog (e.g. using Homebrew, installing Xcode, etc.):
> brew tap coin-or-tools/coinor
> brew install symphony
> brew install pkg-config
But I still get the same ERROR message. The one way I was successful was installing the same package in a Windows environment (via Parallels).
Thank you.

I got lots of help from the folks at https://github.com/coin-or-tools/homebrew-coinor, specifically Ted Ralphs. Here's what he figured out:
OK, I got RSymphony to install, but it involved some hacking. For now, first grab and unpack the source with
wget https://cran.revolutionanalytics.com/src/contrib/Rsymphony_0.1-25.tar.gz
tar -xzvf Rsymphony_0.1-25.tar.gz
Now edit Rsymphony/configure and comment out the test for finding SYMPHONY libraries and headers, which is broken (not sure yet how to fix it).
#if test ${status} -ne 0; then
# echo "Cannot find SYMPHONY libraries and headers."
# echo "See <https://projects.coin-or.org/SYMPHONY>."
# exit 1
#fi
Next edit Rsymphony/R_symphony.cc and change
#include <coin/symphony.h>
to
#include <symphony.h>
Finally, do
r CMD install Rsymphony
It worked for me, but if there are any additional errors they should be easy to fix. I'll try to report this to the Rsymphony guys and see if we can get it fixed.
In addition, I had to fix my fortran. These links helped with that:
http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/
OSX Installing Rsymphony - linking headers and libs

The above suggestion worked great for me with the edits of:
brew install wget
wget https://cran.revolutionanalytics.com/src/contrib/Rsymphony_0.1-28.tar.gz
tar -xzvf Rsymphony_0.1-28.tar.gz
And I found the /R_symphony.cc in the src folder. Thanks!!!

Related

Package ‘stringr’ was installed before R 4.0.0: please re-install it BiocManager Installation path not writeable, unable to update packages

Got the errors
Error : package ‘stringr’ was installed before R 4.0.0: please re-install it and BiocManager Installation path not writeable, unable to update packages:
and further down the road rstudio gave me
/usr/local/lib/R/lib/libR.so not found
I had a similar problem when upgrading from R 3.6 to 4.0 in my Linux box.
I am also answering this because this question is one of the first results google gives when looking for this problem.
It turns out that, even by removing R (apt purge) there is a folder that remains in the system creating a lot of problems for the future installation.
I want to link the GREAT answer that was given here and saved me:
https://askubuntu.com/questions/1219737/installing-ggplot2-for-r-3-6-on-ubuntu-18-04
In Linux systems you should look in:
$ ls /usr/local/lib/R/site-library
If the folder has a list of directories you should remove everything with:
sudo rm -Rf /usr/local/lib/R/site-library
Then reinstall R and all the libraries.
This is a long answer to how to fix these errors but I assume necessary and also tips and tricks included (e.g. don't install R 4.0.2 right now (Jul 25, 2020)). It caused me a lot of pain because there were many more errors that I ran into on the way.
Error : package ‘stringr’ was installed before R 4.0.0: please re-install it and BiocManager Installation path not writeable, unable to update packages:
I removed .RData in my home folder (invisible, use ls -la) This fixed my problem for the installed before R 4.0.0 error, but did not fix my bioconductor problems. I assume it might work if you only had the re-install error.
After many attempts at trying to get my packages to load but only getting these errors, I opted to reinstall R. In R, I ran .libpaths and deleted all the files in each of the directories. I then reinstalled R by downloading R from https://www.r-project.org/ and ran the general compile commands in the downloaded folder ./configure --enable-R-shlib --with-blas --with-lapack make sudo make install. The --enable-R-shlib is needed for rstudio to be able to use R, but the others aren't.
On Jul 25, 2020 I tried to install from apt on ubuntu, but rstudio was not able to find libR.so (error of /usr/local/lib/R/lib/libR.so not found). I tried to compile from source R 4.0.2 with the ./configure --enable-R-shlib which should make the libR.so but this returned an error.
I assume this to be an underlying problem as running ./configure --enable-R-shlib compile from source with R 4.0.0, I got the files and Rstudio opened up (please fix R 4.0.2 and subsequently apt).
I then ran the general
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.11")
to install biocmanager and it finally worked.

Can not install processr and procesR on Windows

Following this question, I am trying to install the package (running R64 as admin on Windows):
devtools::install_github("markhwhiteii/processr")
or
devtools::install_github("cardiomoon/processR")
However, I get the error message:
Error: Failed to install 'processr' from GitHub:
(converted from warning) cannot remove prior installation of package 'digest'
no matter which update option I select. Running the command .libPaths() I found the packages installation folder C:/Program Files/R/R-3.6.2/library and manually deleted the digest package and reinstalled it with package.install("digest"). But I still get the same error! I would appreciate it if you could help me understand what is the problem and how I can resolve it.
The simplest solution is to say no when install_github asks if it should replace digest.
If it still fails for some reason (and I can't see why; neither package requires a specific version of digest and you've reinstalled it in any case), then the problem is that devtools itself uses digest, so it can't be removed as long as devtools is loaded. So you can't use install_github.
You have a couple of options:
Clone the repo, then from the command line, run R CMD INSTALL . in that directory. Note that you'll need to insert the path to your R executable.
Install from the GitHub archive of the master branch: install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
The steps to install the markhwhiteii/processr package:
install.packages("devtools")
library(devtools)
install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
for testing the instalation:
library(processr)
processr::model1
Sent a PR on the GitHub repo.
and if you want to run R in the Jupyter environment just follow the instructions to install and regsiter the kernel:
install.packages('IRkernel')
IRkernel::installspec()

R-Package tmap/protolite installation failed:

I am working on Ubuntu 16.04 with R-version 3.4.2.
I want to install the R-Package "protolite" (more precisely, I want to install "tmap" where protolite is a prerequisite). I have libprotocol version 2.6.1 installed:
$ protoc --version
returns libprotoc 2.6.1.
When I type install.packages "protolite" , R gives me the warning:
Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing 'protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found
Later the installation fails with
/usr/bin/ld: cannot find -lprotobuf
collect2: error: ld returned 1 exit status
Since libprotocoll is installed, I searched for the pc file by
apt-file search protobuf.pc
which returned
libprotobuf-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/protobuf.pc
So I added
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
however, this did not resolve the issue. Can somebody help me out?
Note: I spent hours trying to install "tmap" by now, at first my problem was that I had installed libprotocol 3.2, which I had to delete to install tmap/protolite because the installation required libprotocol 2.6.1. So maybe this deletion/new installation brought some things in disorder on my computer.
Using
sudo apt-get install -y libprotobuf-dev protobuf-compiler
worked for me.
For anyone having the same problem. I checked with the Synaptic Package manager and found that not all libprotobuf versions were installed. In fact, just a lite version had been installed. Installing all "libprotobuf-dev 2.6.1-1.3 made it work.

R: Having trouble installing rpanel

I am trying to install the packages rpanel and tkrplot on RStudio. After downloading and installing there I got this message:
downloaded 686 Kb
* installing *source* package ‘rpanel’ ...
** package ‘rpanel’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
Error in structure(.External(.C_dotTcl, ...), class = "tclObj") :
[tcl] can't find package BWidget.
Error : unable to load R code in package ‘rpanel’
ERROR: lazy loading failed for package ‘rpanel’
* removing ‘..../R/i686-pc-linux-gnu-library/3.0/rpanel’
Warning in install.packages :
installation of package ‘rpanel’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp1MdC0f/downloaded_packages’
I already installed BWidget on my own, but it didn't help.
Anyone any ideas about this problem and maybe can help me?
The system is Ubuntu 12.04.
Under windows 7 there is no problem and everything is working fine.
There are easier ways to install BWidgets. On my mac with Macports I did:
sudo port install BWidget
On Ubuntu you can probably install it with apt-get:
sudo apt-get install bwidget
"Stumbled across this while looking for an answer to the same question. Like an unfortunate number of library authors, the BWidgets people have assumed that the only people who need to use their libraries are planning to code with them. For those of us who've never used TCL, the installation instructions mean nothing.
From the a document called tuto-install-tkabber on the tkabber.jabber.ru website (irritating spam catcher won't let me post a URL), the answer is:
Install the BWidgets directory into the "lib" directory returned by:
whereis tcl
It should look something like: /usr/lib/tcl8.4"
from http://www.linuxquestions.org/questions/linux-software-2/where-to-install-bwidget-tcl-98583/ did the trick for me
Also I got BWidget from: http://sourceforge.net/projects/tcllib/files/BWidget/1.7.0/BWidget-1.7.0.zip/download
#Calimo's answer worked for me on Linux Mint 18.3 RStudio R 3.6.0. I would have commented in #Calimo's thread except for the stupid 50 reputation limit.
sudo apt-get install bwidget
Also works for Ubuntu 18 R 3.4.4 but if you get an X11 issue with rgl then this helped from #Ouistiti.
I had similar issues trying to get biotools working in Rstudio (on Ubuntu 16.04), where rpanel and tkrplot are required. Even after installing Bwidget per Calimo's answer, I got the error installation of package ‘tkrplot’ had non-zero exit status because tk.h: No such file or directory. If you look in the directory, this error is definitely correct. You need to get tk.h in there. I found out how to do so elsewhere on stackexchange:
Install tcl-dev package using apt or synaptic; tcl contains the
runtime, while tcl-devel contains header and development files. Do the
same with tk-dev
from:
https://stackoverflow.com/a/9649478/10405322
Thus,
sudo apt-get install tcl-dev
sudo apt-get install tk-dev
download BWidget from
http://sourceforge.net/project/showfiles.php?group_id=12883
once you get the archive BWidget-1.7.0.tar.gz move it to /usr/local/lib and install it with following code in terminal:
sudo mv /some_download_path/BWidget-1.7.0.tar.gz /usr/local/lib
cd /usr/loca/lib
sudo tar zxf BWidget-1.7.0.tar.gz
ok, done.

R installation for RHive and/or RStudio("--enable-R-shlib")

I suspect I am having a problem with my R installation, something that has to do with "--enable-R-shlib".
Can someone explain if this is something that I can fix using apt-get?
More specifically:
I am having trouble getting installing the RHive package.
I Installed R from scratch, following the instructions in (for example):
http://cran.ru.ac.za/bin/linux/ubuntu/
basically, just doing:
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
Next I opened R and installed rJava:
install.packages("rJava")
which worked fine.
Next I tried installing RHive:
install.packages("RHive")
at which point the installation fails with the following message:
* installing *source* package ‘Rserve’ ...
** package ‘Rserve’ successfully unpacked and MD5 sums checked
checking whether to compile the server... yes
configure: error: R was configured without --enable-R-shlib or --enable-R-static-lib
*** Rserve requires R (shared or static) library. ***
*** Please install R library or compile R with either --enable-R-shlib ***
*** or --enable-R-static-lib support ***
What Should I Do?
Also, I installed RStudio and this fails at startup with a related message:
"R shared library (/usr/local/lib64/R/lib/libR.so) not found. If this is a custom build of R, was it built with the --enable-R-shlib option"
All of which leads me to believe it is all related to the same problem. Weird thing is, I followed the same procedure on a different machine, and all seems to work fine...
I had the same problem.
In my case I changed R_HOME like this Sys.setenv(R_HOME="/usr/lib/R")
R, as well as r-cran-rjava and r-cran-rserve are available for Debian and Ubuntu as part of the basic distribution.
Can you not use those packages? They certainly work for me and many, many other people at least as far as RStudio is concerned -- I have not tried RHive myself.

Resources