2016-11-12 76 views
1

我試圖獲得一個簡單的OpenCPU應用程序(從https://www.opencpu.org/download.html)。在rstudio OnAttach中啓動OpenCPU時出錯

因爲我在Ubuntu在AWS上,我按照說明Ubuntu的:

# Requires Ubuntu 14.04 (Trusty) or 16.04 (Xenial) 
sudo add-apt-repository -y ppa:opencpu/opencpu-1.6 
sudo apt-get update 
sudo apt-get upgrade 

# Installs OpenCPU server 
sudo apt-get install -y opencpu 
# Done! Open http://yourhost/ocpu in your browser 

# Optional: installs rstudio in http://yourhost/rstudio 
sudo apt-get install -y rstudio-server 

經過所有權利。

接下來,我嘗試在Rstudio安裝包:

install.packages("opencpu") 
Installing package into ‘/home/ruser/R/x86_64-pc-linux-gnu-library/3.3’ 
(as ‘lib’ is unspecified) 
trying URL 'https://cran.rstudio.com/src/contrib/opencpu_1.6.1.tar.gz' 
Content type 'unknown' length 563159 bytes (549 KB) 
================================================== 
downloaded 549 KB 

* installing *source* package ‘opencpu’ ... 
** package ‘opencpu’ successfully unpacked and MD5 sums checked 
** R 
** inst 
** preparing package for lazy loading 
** help 
*** installing help indices 
** building package indices 
** installing vignettes 
** testing if installed package can be loaded 
* DONE (opencpu) 

The downloaded source packages are in 
    ‘/tmp/RtmpON3Ujv/downloaded_packages’ 
> library(opencpu) 
Initiating OpenCPU server... 
Using config: /home/ruser/.opencpu.conf 
OpenCPU started. 
[httpuv] http://myserver/rstudio/p/1529/ocpu 
Error : .onAttach failed in attachNamespace() for 'opencpu', details: 
    call: rhttpd$init() 
    error: could not find function "startDynamicHelp" 
Error: package or namespace load failed for ‘opencpu’ 

這是我的錯誤。試圖用Google搜索錯誤,但沒有運氣。

+1

你是混合了雲服務器和單用戶的服務器。您不需要手動啓動R。嘗試在瀏覽器中打開「http:// yourhostname」。 – Jeroen

回答

0

@gaurav是正確的。關於opencpu的說明非常具有誤導性,因爲它看起來像是顯示了一組指令,但實際上,R命令是用於在交互式R會話中運行opencpu,而不是用於新安裝的opencpu雲服務器。

要在新的雲服務器上運行示例應用程序(我假設您正在嘗試這麼做),您需要按照雲服務器的說明操作。

這裏的鏈接到雲服務器文檔,幫助我:

https://cran.r-project.org/web/packages/opencpu/vignettes/opencpu-server.pdf

具體來說,要運行示例應用程序,你需要啓動R對話爲根,並安裝包:

sudo -i 
R 

#then from r session 
library(devtools) 
install_github("opencpu/gitstats") 
install_github("opencpu/stocks") 

#then quit 
quit() 

exit 

然後重新啓動opencpu服務:

sudo service opencpu restart 

然後,您可以使用opencpu api導航到包。在Web瀏覽器,請訪問:

http://localhost/ocpu/library/gitstats/www/

和voila-