Install mxnet package in Rstudio Cloud - r

I want to install the package mxnet on Rstudio Cloud, which is the cloud version of Rstudio. I tried it first with R 3.6, then R 3.5.3, neither worked.
I tried to install from with this piece of code:
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
cran["dmlc"] <- "https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/"
options(repos = cran)
install.packages("mxnet")
I got a 404 error file not found. Then i tried downloading the .tar.gz installation file associated with LInux/R/CPU, and it also gave an error:
ERROR: cannot extract package from
‘/cloud/project/apache-mxnet-src-1.5.0-incubating.tar.gz’
Here is my session info:
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS
Thanks for your help. I need to get this package installed and running on Rstudio Cloud.

RStudio Cloud is linux based
Platform: x86_64-pc-linux-gnu (64-bit)
The snippet you use is instruction for R on Windows CPU platform. R on Linux instruction there says to build it from source which wouldn't work on the cloud. Seems like no CRAN repo currently has binaries of the linux version of the mxnet package.
RStudio Cloud gives you access to the terminal and you can even download the sources for mxnet, but to build it you need sudo which the terminal doesn't provide so building from source stops on ./install_mxnet_ubuntu_r.sh command here:
git clone --recursive https://github.com/apache/incubator-mxnet.git mxnet
cd mxnet/docs/install
./install_mxnet_ubuntu_r.sh

Related

RStudio not loading RevoScaleR on Ubuntu 16.04

Long story short:
Calling rxImport() works fine in a Terminal R session but fails when using RStudio, despite using the same installation of R.
Setup:
I'd like to use RevoScaleR functions like rxImport(...) on Ubuntu. I have an installation of RStudio and R done through package manager.
I've installed MS Rclient following the instructions here.
Everything seems to work as I can run in the terminal:
/opt/microsoft/rclient/3.4.3/bin/R$ ./R
R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
Microsoft R Open 3.4.3
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2018 Microsoft
Loading Microsoft R Client packages, version 3.4.3.0097.
Microsoft R Client limits some functions to available memory.
See: https://go.microsoft.com/fwlink/?linkid=799476 for information
about additional features.
...
Using the Intel MKL for parallel mathematical computing (using 2 cores).
Default CRAN mirror snapshot taken on 2018-01-01.
See: https://mran.microsoft.com/.
> R.home()
[1] "/opt/microsoft/rclient/3.4.3/runtime/R"
> rxImport()
Error in rxImport() : 'inData' must be specified.
So the function is loaded and available by default. Now I tell the RStudio to use this installation of R by adding the following at the end of ~/.profile :
RSTUDIO_WHICH_R="/opt/microsoft/rclient/3.4.3/bin/R/R"
Error:
When I run rstudio I get a R console in the IDE saying:
> R.home()
[1] "/opt/microsoft/rclient/3.4.3/runtime/R"
> rxImport()
Error in rxImport() : could not find function "rxImport"
Possible causes
I've found some threads with people complaining about MS packages not dealing properly with ~ and working directory (i.e. on a remote server), setwd() doesn't solve my issue, though.
Do you have any ideas on how to get RevoScaleR to work with RStudio? Thanks in advance.
An answer I got from Github:
https://github.com/rstudio/rstudio/issues/2455#issuecomment-375327109
try setting
R_LIBS_SITE=/opt/microsoft/rclient/3.4.3/libraries/RServer
in
/opt/microsoft/rclient/3.4.3/runtime/R/etc/Renviron

Loading rJava on Mac OS High Sierra

I am trying to install rJava package for running the XLConnect package.
Here are my system details;
R studio:Version 1.0.153
Mac OS High Sierra Version 10.13.1 (17B1003)
R version: 3.4.2
jdk-9.0.1
however, i get the following error:
I have already followed the following threads on this topic but they don't work for me:
trouble installing and loading rJava on mac El Capitan
rJava does not run on macOS Sierra
rJava load error in RStudio/R after "upgrading" to OSX Yosemite
A push in the right direction will be greatly appreciated !!
I used the procedure at the following website:
https://github.com/MTFA/CohortEx/wiki/Run-rJava-with-RStudio-under-OSX-10.10,-10.11-(El-Capitan)-or-10.12-(Sierra)
The main steps are:
Install Apple Java 6
Install the newest Java from Oracle
Fix JAVA_HOME to point to the new version. Terminal command: sudo R CMD javareconf
Install rJava from source. Terminal command: unset JAVA_HOME; R --quiet -e 'install.packages("rJava", type="source", repos="http://cran.us.r-project.org")'
My environment is
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
macOS High Sierra 10.13.2
I encountered this problem today and spent whole day trying to fix it. Luckily I found the solution at last. It works for me.
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
Note:
If the get ln: /usr/local/lib/libjvm.dylib: File exists
in terminal. Then you should delete this file and run the command above again.
This worked for me on an M1 Mac:
Download jdk-19_macos-x64_bin.tar.gz from Java
Unzip the file and move it to /Library/Java/JavaVirtualMachines/ (may need to sudo su first)
Set export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk-19_macos-x64_bin/Contents/Home'
Run R CMD javareconf
#Kayle Sawyer's answer works almost perfectly, but you might need to reinstall command line tools first. Easiest way is to run the following in Terminal:
xcode-select --install
If you get an error saying command line tools are already installed, you can reinstall the package with this:
cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg
You might need to update the second command based on your OS version.
Answers from https://github.com/frida/frida/issues/338

Cannot run R from terminal after upgrading to macOS Sierra

I recently updated my macbook to macOS Sierra (Version 10.12.3 (16D32)), and I am no longer able to run R directly from Terminal:
DN51ssqi:~ kjytay$ R
-bash: R: command not found
DN51ssqi:~ kjytay$ R --version
-bash: R: command not found
Opening R from the Applications folder or from RStudio works fine. Anyone experience this issue/has been able to fix it?
Here is my R version information:
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major 3
minor 3.2
year 2016
month 10
day 31
svn rev 71607
language R
version.string R version 3.3.2 (2016-10-31)
nickname Sincere Pumpkin Patch
This is just a guess, but I'm thinking this is probably an issue with your PATH settings, which might have been overwritten when you upgraded*. Seems worth a try at least. This is from the RStudio support pages**:
R from source (including MacPorts and Homebrew)
When R is installed from CRAN on OS X the R executable is installed at
/usr/bin/R. However, if R is installed directly from source or via a
package manager like MacPorts or Homebrew, then the R executable is
installed to either /usr/local/bin/R (Homebrew) or /opt/local/bin/R
(MacPorts). In order to support these variations, RStudio scans for
the R executable in the following sequence:
/usr/bin/R
/usr/local/bin/R
/opt/local/bin/R
If RStudio is not able to locate R by scanning these locations, it
will fall back to using whatever version of R is located at
/Library/Frameworks/R.framework/.
If RStudio is finding R OK, then you must have it at one of these locations. Make sure these locations are in your $PATH list:
In the Terminal:
echo $PATH
Will display your current PATHs list. If any of the locations in the RStudio quote are missing, you can see if that's where R is located by trying to specify that location. For example:
/usr/local/bin/R
If that works to start R, just add that location to your PATHs list:
export PATH=$PATH:/usr/local/bin
So that OSX knows where to find it!
* It's been noted elsewhere that homebrew breaks, for example, on upgrade to Sierra. Here's a blog post outlining some steps an R user might like to take after the upgrade: http://www.statsblogs.com/2017/01/26/upgrading-to-macos-sierra-nee-osx-for-r-users/
** Here's the support page where the quote is from https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R

Error downloading previous package version in RStudio even though manual download works

I am trying to follow the instructions from RStudio to install an older version of ggplot2 with devtools::install_version. However, I am getting the following error:
> devtools::install_version("ggplot2", version = "2.1.0", repos = "https://cran.r-project.org")
Downloading package from url: https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_2.1.0.tar.gz
/usr/bin/tar: Cannot execute remote shell: No such file or directory
/usr/bin/tar: C\:\\Users\\..\RtmpmqySfr\\file75c16051e90.tar.gz: Cannot open: I/O error
/usr/bin/tar: Error is not recoverable: exiting now
Error: Does not appear to be an R package (no DESCRIPTION)
My R version:
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
My RStudio version:
0.99.902
My devtools version:
devtools_1.12.0
I seem to be able to download the compressed package files directly by going to the URL found by devtools.
Why am I getting this error and how do I fix it?

Linking Bash R to RStudio, Version/Package Libraries Out of Sync

I am struggling with how to link/sync the version of R that I access from the bash terminal on Mac OSX to the version of R (and R libraries) that I have in R Studio.
Some background:
I installed R/R studio by downloading the most recent versions available from the developer's websites as of 10/9/2016.
I previously had R installed on bash, but that version was 3.2.5 not 3.3.1 that I downloaded online. So if I tried to open an R script from bash, it would launch a deprecated version of RStudio that crashed.
To fix this, I used Brew to unlink the old version of R, and reinstall R in bash.
brew unlink r
brew install R
The Problems:
Now when I launch an R script from terminal, it opens the correct version of RStudio, which has a version:
version.string R version 3.3.1 (2016-06-21)
nickname Bug in Your Hair
However, if in bash I simply launch R using $ R, I have version:
R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Furthermore, the packages installed in RStudio are not linked. In Rstudio I can load a package library such as library(tidyverse) without error.
In bash's $ R, the above command library(tidyverse) throws an error:
Error in library(tidyverse) : there is no package called ‘tidyverse’
What I would like is a way to link the bash version of R and Rstudio such that the R-versions are the same and such that packages installed in R are recognized in RStudio, and RStudio installed packages can load in bash R.
Thanks for your help.
The default behavior should be that R and Rstudio share the same versions and packages. I imagine the issue you're seeing has to do with having an outdated version of homebrew at the time of install.
I would recommend uninstalling and re-installing, as I was unable to reproduce your issue using the latest Homebrew packages:
brew uninstall r
brew update
brew update # (run twice)
brew cleanup
brew doctor
Fix any issues raised by brew doctor
brew tap homebrew/science
brew install r
I did not have Rstudio installed, so I installed it from Homebrew using cask -- This should not be necessary if you already have Rstudio installed from the developer's site.
brew cask install rstudio
After taking these steps I get the following in both R Studio and in the terminal:
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
library(tidyverse)
Error in library(tidyverse) : there is no package called ‘tidyverse’
At this point, in my terminal window, I ran:
install.packages("tidyverse")
Finally, returning to R Studio after the install:
> library(tidyverse)
Loading tidyverse: ggplot2
Loading tidyverse: tibble
Loading tidyverse: tidyr
Loading tidyverse: readr
Loading tidyverse: purrr
Loading tidyverse: dplyr
Conflicts with tidy packages --------------------
filter(): dplyr, stats
lag(): dplyr, stats

Resources