nsh87 / shinyVM

Create a local Shiny Server for R
31 stars 18 forks source link

download packages #3

Closed Guiui21 closed 9 years ago

Guiui21 commented 9 years ago

Hi, how can download a package like this one: https://github.com/ramnathv/rCharts on my VM ?

nsh87 commented 9 years ago

The 'best practice' way would be to edit fabfile.py and create a function that installs that package. Then when you run fab vagrant setup_vagrant that package will be installed. Take a look at the existing function sub_install_rmarkdown() for an example. Based on the rCharts documentation for how to install, your new function will probably look something like this:

def sub_install_rCharts():
"""Install rCharts, for publishing interactive JavaScript visuals, via GitHub."""
sudo('R -e "require(devtools); install_github(\'ramnathv/rCharts\')"')

The install procedure is verbatim from their documentation. Make sure you actually call that function somewhere in fabfile.py, and in your server.R file you should load the rCharts library in like any other R library, probably in such a way where it gets loaded once and not every time a user connects. See here.

Guiui21 commented 9 years ago

Thanks, but I got this error:

"""Install rCharts, for publishing interactive JavaScript visuals, via GitHub."""
                                                                                ^

IndentationError: expected an indented block

Do you have any idea ?

Le 2015-02-18 à 13:21, Nikhil Haas notifications@github.com a écrit :

Closed #3.

— Reply to this email directly or view it on GitHub.

nsh87 commented 9 years ago

Yup, the indentation of Python is wrong so it's complaining. You might need to retype the function by hand. I'm guessing you don't have devtools installed either, so you need to install that also, just like with the Rmarkdown example. I'll leave this ticket open for now, you can close it once you get things working.

nsh87 commented 9 years ago

Here, this will get things working. The package you are trying to install has a lot of dependencies which aren't installed by default. In fabfile.py add 'libcurl4-openssl-dev' to the list of INSTALLED_PACKAGES. Then the function to install rCharts should look like this:

def sub_install_rCharts():
"""Install rCharts, for publishing interactive JavaScript visuals, via GitHub."""
sudo('R -e "install.packages(\'devtools\', '
         'repos=\'http://cran.rstudio.com/\', dependencies=TRUE)"')
sudo('R -e "install.packages(\'plyr\', '
         'repos=\'http://cran.rstudio.com/\', dependencies=TRUE)"')
sudo('R -e "require(devtools); install_github(\'ramnathv/rCharts\')"')
Guiui21 commented 9 years ago

It works. Thank you so much !

Le 2015-02-18 à 13:53, Nikhil Haas notifications@github.com a écrit :

libcurl4-openssl-dev

Guiui21 commented 9 years ago

Hi,

Another quick question, is there any pre-configure static IP address on the VM ? I’m trying to use a static IP on my VM to put my pages online, and not only on a localhost.

Thanks.

Le 2015-02-18 à 13:53, Nikhil Haas notifications@github.com a écrit :

Here, this will get things working. The package you are trying to install has a lot of dependencies which aren't installed by default. In fabfile.py add 'libcurl4-openssl-dev' to the list of INSTALLED_PACKAGES. Then the function to install rCharts should look like this:

def sub_install_rCharts(): """Install rCharts, for publishing interactive JavaScript visuals, via GitHub.""" sudo('R -e "install.packages(\'devtools\', ' 'repos=\'http://cran.rstudio.com/\', dependencies=TRUE)"') sudo('R -e "install.packages(\'plyr\', ' 'repos=\'http://cran.rstudio.com/\', dependencies=TRUE)"') sudo('R -e "require(devtools); install_github(\'ramnathv/rCharts\')"') — Reply to this email directly or view it on GitHub.

nsh87 commented 9 years ago

Look in Vagrantfile, it has all the settings for the VM, including the IP, but I'm not sure why you'd need to change that unless it conflicts with your server's IP. HTTP requests are made over port 80, Shiny is listening on port 3838. If you want to make this accessible at some public server you need to forward port 80 on the server to 3838 of the VM. You can change the port forwarding settings in Vagrantfile. As long as nothing else on your server is listening on port 80 that will work, then just visit http://mypublicserver.

On Feb 23, 2015, at 7:03 AM, Guiui21 notifications@github.com wrote:

Hi,

Another quick question, is there any pre-configure static IP address on the VM ? I’m trying to use a static IP on my VM to put my pages online, and not only on a localhost.

Thanks.

Le 2015-02-18 à 13:53, Nikhil Haas notifications@github.com a écrit :

Here, this will get things working. The package you are trying to install has a lot of dependencies which aren't installed by default. In fabfile.py add 'libcurl4-openssl-dev' to the list of INSTALLED_PACKAGES. Then the function to install rCharts should look like this:

def sub_install_rCharts(): """Install rCharts, for publishing interactive JavaScript visuals, via GitHub.""" sudo('R -e "install.packages(\'devtools\', ' 'repos=\'http://cran.rstudio.com/\', dependencies=TRUE)"') sudo('R -e "install.packages(\'plyr\', ' 'repos=\'http://cran.rstudio.com/\', dependencies=TRUE)"') sudo('R -e "require(devtools); install_github(\'ramnathv/rCharts\')"') — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.