Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在googlecolab上运行RStudio_R_Rstudio_Google Colaboratory - Fatal编程技术网

在googlecolab上运行RStudio

在googlecolab上运行RStudio,r,rstudio,google-colaboratory,R,Rstudio,Google Colaboratory,有没有办法在Google Colab上安装和运行RStudio 我知道可以在GoogleColab上运行R代码。因此,我想知道是否还有安装和运行RStudio的方法?我经常使用Google Colab和RStudio。为了简化设置,我通常复制并粘贴以下设置脚本(并使用备选方案2) 创建新的Google Colab笔记本后,执行以下命令: # Add new user called "rstudio" and define password (here "passwo

有没有办法在Google Colab上安装和运行RStudio


我知道可以在GoogleColab上运行R代码。因此,我想知道是否还有安装和运行RStudio的方法?

我经常使用Google Colab和RStudio。为了简化设置,我通常复制并粘贴以下设置脚本(并使用备选方案2)

创建新的Google Colab笔记本后,执行以下命令:

# Add new user called "rstudio" and define password (here "password123")
!sudo useradd -m -s /bin/bash rstudio
!echo rstudio:password123 | chpasswd

# Install R and RStudio Server (Don't forget to update version to latest version)
!apt-get update
!apt-get install r-base
!apt-get install gdebi-core
!wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.4.1103-amd64.deb
!gdebi -n rstudio-server-1.4.1103-amd64.deb

#===============================================================================
# ALTERNATIVE 1: Use ngrok 
#===============================================================================
# Advantage: Runs in the background
# Disadvantage: Not so stable 
# (often 429 errors during RStudio usage due to max 20 connections without account)
# Optionally register for a free accoount which gets this number up to 40 connections:
# https://ngrok.com/pricing 

# Install ngrok (https://ngrok.com/)
!wget -c https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip -o ngrok-stable-linux-amd64.zip

# Run ngrok to tunnel RStudio app port 8787 to the outside world. 
# This command runs in the background.
get_ipython().system_raw('./ngrok http 8787 &')

# Get the public URL where you can access the Dash app. Copy this URL.
! printf "\n\nClick on the following link: "
! curl -s http://localhost:4040/api/tunnels | python3 -c \
    "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"

 # ==> To access to the RStudio server 
 #     - click on this link and 
 #     - use the username "rstudio" and 
 #     - the password you defined at the first cell ("password123" in this example).

#===============================================================================
# ALTERNATIVE 2 (preferred): Use localtunnel 
#===============================================================================
# (see also: https://github.com/naru-T/RstudioServer_on_Colab/blob/master/Rstudio_server.ipynb)
# Advantage: Stable usage of RStudio
# Disadvantage: Does not run in the background (i.e. Colab blocked)

# Install localtunnel
!npm install -g npm
!npm install -g localtunnel

# Run localtunnel to tunnel RStudio app port 8787 to the outside world. 
# This command runs in the background.
!lt --port 8787 

 # ==> To access to the RStudio server 
 #     - click on this link, 
 #     - click button "Click to Continue" on the "friendly reminder" page,
 #     - use the username "rstudio" and 
 #     - the password you defined at the first cell ("password123" in this example).