Did anyone get R to work?

Hi, I’ve been struggling to get working with R inside the AD workbench desktops.

I tried both Windows and Linux, with different issues…

 

On Linux, I ran the setup script, however Jupyter only lists Python3 as an available kernel.
R isn’t listed. I tried to re-run the setup script but it gets stuck because some files are already installed.

On Windows, installed Anaconda and R. Everything looks good. Then when I’m in Jupyter, I load the starter notebook, it shows the R kernel as connected, but can’t get any code to actually run.

I’m stuck. :fearful:

Hi again,

update: I don’t know how, but it now works on Windows, but still some issues pending…

Can’t run the install.packages(“ggplot2”) line.
It says that it cannot open URL https://cran.r-project.org/

Also, I read that AICrowd should be available from within the desktop, however it doesn’t appear to be available.

Both issues are probably related to the very strict internet connectivity.

Hello @michael_bordeleau

Our setup script installs R using conda. You can run the following to install R with some necessary packages

conda install --yes -c conda-forge \
    'r-base=4.0.3' \
    'r-caret=6.*' \
    'r-crayon=1.4*' \
    'r-devtools=2.3*' \
    'r-forecast=8.13*' \
    'r-hexbin=1.28*' \
    'r-htmltools=0.5*' \
    'r-htmlwidgets=1.5*' \
    'r-irkernel=1.1*' \
    'r-nycflights13=1.0*' \
    'r-randomforest=4.6*' \
    'r-rcurl=1.98*' \
    'r-rmarkdown=2.6*' \
    'r-rodbc=1.3*' \
    'r-rsqlite=2.2*' \
    'r-shiny=1.6*' \
    'r-tidyverse=1.3*' \
    'unixodbc=2.3.*' \
    'r-tidymodels=0.1*'

In case you don’t have conda installed, you can download it from https://repo.anaconda.com/archive/

Coming to the package installation, can you try specifying the cran mirror to use? For example something like

install.packages('caret', repos='http://cran.ma.imperial.ac.uk/')

As you might have noticed already, internet access is restricted in the workspace. You can find the list of allowed domains at https://portal.addi.ad-datainitiative.org/security. We will work with AD workbench team to get the repositories whitelisted in the meantime.

2 Likes

Hi michael_bordeleau,

Thanks to Jyotish for your suggestion above.

Cran mirrors are whitelisted, but it appears that when working from the Jupyter Notebook explicitly specifying a mirror is needed, as example from above:
install.packages('caret', repos='http://cran.ma.imperial.ac.uk/')
There are also 4 mirrors that are allowed:
www.stats.bris.ac.uk
cran.ma.imperial.ac.uk
cran.cnr.berkeley.edu
mran.microsoft.com

Can you try one of the mirrors and let me know.

regards,
Ned

Hi, thanks for your suggestions. I can now install and load R packages.

 

There are other issues I’m facing with the R starter notebook.

In the Setup AIcrowd Utilities section, I’m getting a Warning Message.
I’d love to show a screenshot, but fyi, can’t login into discourse in the Windows desktop. (only browse)

running command ‘curl -sL … > aicrowd.R’ had status 6

I went to the url and loaded manually the three functions.
However, when I try to submit, it says:
"Error in system(paste (“aicrowd login --api-key”, api_key), intern = TRUE): ‘aicrowd’ not found

1 Like

Hello @michael_bordeleau

Unfortunately, internet explorer is not fully supported. However, one workaround is to download the installer locally on your machine and copy it to the VM. In case you want to install chrome, you need to download the standalone version of the chrome installer (https://www.google.com/intl/en/chrome/?standalone=1)

For more information, please refer this post


Can you try using

curl -k --output aicrowd.R https://gitlab.aicrowd.com/snippets/34200/raw

Can you confirm if you executed the cell that contains pip3 install -q -U aicrowd-cli?

1 Like

Hi, I tried using your suggestion:

Still getting an error.

And when I try to run the other line (pip3…) , it just hangs for a very long time… Then ultimately returns an error as well.

And to clarify, I’m on a Windows workspace.

PS: In case you had the url mixed up, I tried your command line with the previous url. Error as well.

And fyi, here was the original error using the notebook code:

Let me know what I can do to help us debug this…

1 Like

Hi @michael_bordeleau,

We are seeing many participants facing issue with the internet connection on Windows VM. This issue is probably because of not setting up of proxy by default. There are 2 ways to potentially resolve this issue,

  1. Reboot your system. Once your VM boots, you will notice a command prompt window. Please let it finish and do not close it.
  2. Set up proxy manually by typing these commands on the Anaconda prompt,
set HTTP_PROXY=http://10.0.0.5:3128
set HTTPS_PROXY=http://10.0.0.5:3128
set NO_PROXY=localhost,127.0.0.1
jupyter-notebook

Please let us know if you still face the issue.

Regards
Ayush

Here is what I’ve done.

Fresh boot of a Windows workspace. I did see a command prompt windows which closed itself in a couple of seconds.

Opened Anaconda Prompt.

My notebook is saved into the /Document/ folder.

Then I ran the code lines.

The original notebook line returned a new kind of error, however the new code line and the pip3 did not return any error.

Will try to submit and report in a future response.

Hey @michael_bordeleau,

The curl command you are using seems to be wrong. Try using,

curl -k --output r.ipynb https://gitlab.aicrowd.com/snippets/34200/raw

Ayush

Hi,
I followed the instructions shared by @michael_bordeleau, and the first lines of code seem to work (no warning nor error). I managed to download aicrowd.R file.
I can’t reach CRAN url to download a library, but I can load already installed ones, load the datasets and made some explorations.

But I got an error when I tried to linked with my Aicrowd account.

aicrowd_login(AICROWD_API_KEY)

running command … had status 1

I copy-paste directly from my aicrowd page, so I don’t think I made an error. Do you know what could be the problem?

As posted above, to be able to install packages, you need to point to a CRAN mirror.

Hi all R users!

Here’s a status update for anyone wanting to work with R.

 

Windows

  • R installation works :ballot_box_with_check:
  • R packages install works, specifying the proxies, and pointing to CRAN mirrors. :ballot_box_with_check:
  • Submission still fails. :x: @jyotish is hopefully still working on this.
     

Being somewhat stalled :mantelpiece_clock:, I jumped over to Linux and tried to make it work this time around. :hammer_and_wrench:

 
Linux

  • R installation finally worked. Had to re-run this portion of the script.
  • Jupyter detects R kernel. :ballot_box_with_check:
  • Submission works! :ballot_box_with_check:
  • For some weird reason, some packages do not install. :x:

 

More specifically, xgboost won’t install, and I tried all 4 mirrors.

Error:


image

@nrad Any clue on this issue, as you did help me out initially with regards to packages on the Windows VM.

Thanks a bunch!

3 Likes

I think I solved my issue…

I tried installing xgboost through the terminal with the following command.

It looks like it worked.
Unless staff says otherwise, I’ll consider this as my quick fix!

2 Likes

Update to this thread:

Here’s my starter notebook to get any R user up and ready fast. :checkered_flag:

3 Likes