I am working in a Windows on-premise server which needs a proxy to establish network connection. I have installed R (4.2.0) and now I need to install some packages. However, every time I try to run the command install.packages("dplyr") for instance, I got an error like:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
I have looked for some suggestions and what I find most is to define the environment variables http_proxy or https_proxy. I have tried to put http_proxy="http://someproxy.aaa.aa:1111/" in the Rprofile file (or directly in the console with Sys.setenv) with or without user:password but I get always the same error.
I wonder if the call is using those proxy settings since it never affects the outcome. I am not even sure if I am setting correctly because the error message is always the same.
Related
I am trying to expose a sample r model as API so I created R package. In my local machine , I am able to get the output using the command :
curl http://local host/5656/ocpu/library/mypackage/R/tv/json -F "input=#test.csv"
But when I am trying the same in my AWS linux cloud server on CentOS , I am not getting the output. I tried the command :
curl 13.228.109.233:8787/p/5656/ocpu/library/mypackage/R/tv/json -F "input=#test.csv"
and I get the output as
http://13.228.109.233:8787/auth-sign-in?appUri=%2Fp%2F5656%2Focpu%2Flibrary%2Fmypackage%2FR%2Ftv%2Fjson .
The R package is loaded into the my R studio server and I am trying to access it using putty. I installed the open cpu using the command :
yum install opencpu-server
It looks like it is asking for some authentication but I am not able to get what it means. Am I missing something here?
Thanks
If one visits the URL with a browser, one sees the RStudio-Server login screen. And indeed, you are connecting to port 8787, which is the default port for Rstudio Server. Try URLs below http://13.228.109.233/ocpu/ instead.
As Ralf suggests, that was the error , I was giving the wrong URL . Also, whenever we install opencpu in CentOS , just doing a 'yum install opencpu-server' might not be sufficient. We need to execute the entire built script: https://github.com/opencpu/opencpu-server/blob/master/rpm/buildscript.sh
Without executing the build script , I was not able to connect to opencpu server.
Just in case someone gets the same issue.
I am troubleshooting an issue that I am running into on a new instance of RStudio on a virtual machine. If I run an R script expFit.R in RStudio, it has no problem finding the needed packages (in this case RODBC and minpack.lm) but if I try to run from the command line
c:\"Program Files"\R\R-3.4.1\bin\x64\Rscript.exe e:\expFit.R
I get the error 'minpack.lm' is not a valid installed package. If I move RODBC to be the first package to load, then it errors on that.
The reason that I am running from command line is that in the real application I am running it from a command line stored procedure in SQL. It doesn't work either way (stored procedure or straight command line). I made sure that the path to the packages is a Path variable.
This works on 2 of my other servers, the only difference being that RStudio is installed so that all users can use it on the server that is getting the error, while the other servers have it installed only in my account.
Any advice would be much appreciated!
Shiny app works fine locally but gets disconnected from the server with following error:
I have installed and loaded the library rgdal, but still keep on getting the error.
I'm guessing when it works locally you're running it on windows?
What does ld /usr/local/lib/R/site-library/rgdal/libs/rgdal.so return?
The error message is telling you that a shared object that the rgdal needs is missing.
This object should have been linked at install time and the install should have failed if it didn't exist (assuming it was installed through R).
At a guess, I'd say you're missing a system dependency, which is something like libgdal-dev or libgdal-devel, depending on your distro.
Based on the error, it looks like you may not have uploaded your data files when you uploaded your app to shiny. Click File > Publish and make sure all of the files, including your app.R (and/or ui & server files) AND your data files are selected.
Or, do you setwd() at the beginning of your code? If so, delete that line and try again.
This question has been asked in: Configure proxy on Rstudio. However, it was never resolved.
I am a user of RStudio 0.99.486 version and R 3.2.2 version. I have tried 2 ways to configure proxy settings in the office without success after reading several suggestions:
FIRST TRY:
Type in Rstudio as first line:
Sys.setenv(http_proxy="http://user_name:password#proxy.company_domain.es:8080/")
Go to:
-Tools, -Global Options, -Packages, and unmark option:
"Use internet library/proxy for HTTP"
I also unmarked the option: "Use secure download method for HTTP".
Besides, I right-clicked on the R x64 3.2.2 icon of the desktop and added after 1 space in the "Target" camp:
http_proxy=http://user_name:password#proxy.company_domain.es:8080/
It did not work as I received the message:
Warning in install.packages : cannot open: HTTP status was '407
Proxy Authentication Required'
SECOND TRY:
Create a notepad file with the name:
.Renviron
Saved it in: "C:\Users\username\Documents".
The file contains inside the following 2 lines:
http_proxy=http://proxy.company_domain.es/
http_proxy_user=user_name:password
When I try installing a package I receive:
"Warning in install.packages : unable to connect to
'cran.rstudio.com' on port 80.
Unable to access index for repository http://cran.rstudio.com/src/contrib"
After running code line: R.home() My R_HOME route is:
"C:/Program Files/R/R-32~1.2"
I appreciate before-hand for your advice and help.
Thank you for your question. It helped me to resolve my issue. I had to unmark the option to use the settings from the Internet Explorer and restart.
Maybe your .Renviron does not contain the proxy port, you have to write
http_proxy=http://proxy.company_domain.es:8080/
http_proxy_user=user_name:password
If you specify
http_proxy_user=ask
it should prompt you for user name and password - then you know that the file is read
I struggled with this when I initially started working behind a proxy. Here's what I believe is to be the solution. Disclaimer, I am working on a Windows 7 Workstation.
Even though when you read through the documentation, R suggests that .Renviron and .Rprofile should be in R.home(), that is not the case for Windows.
By default (I believe), the R.home() for Windows is actually the Documents folder for your user. You can check that with
path.expand("~/")
which defaults to "My Documents" directory.
Therefore, do place the .Renviron file with the content you
already have, disable the Internet Explorer option in RStudio, and
make sure you place the file in "My Documents."
Hope it helps!
I also nearly gave up on this problem until I found this simple solution (R3.3.1):
specify the system environment variables (in Windows Advanced System Settings add the variables http_proxy and https_proxy and set it to
http://user_name:password#proxy.company_domain.es:8080/ with your specific settings)
in the R console type
update.packages(ask='graphics',method="libcurl",checkBuilt=TRUE)
Since R 2.13, R comes with a built-in web server.
Is there a simple way to create a local web server using R with a custom port number?
In python it will be (to use "http://localhost:8080") :
python -m SimpleHTTPServer 8080
I'm aware of Rook but I look for a simple solution.
Take a look at Rook - it's on GitHub. About setting a port number, see ?tools::help.ports it accepts a vector of numbers (integers) and it will choose the first available one. There's also sinartra (CRAN, GitHub), but I'd rather go with Rook.
It looks like servr might be what you're looking for these days.
From github:
To some degree, this package is like python -m SimpleHTTPServer or python -m http.server.
https://github.com/yihui/servr
https://cran.rstudio.com/web/packages/servr/index.html
Example code
writeLines("<h1>Hi</H1>", "index.html")
# install.packages("servr")
library(servr)
servr::httd()
# createTcpServer: address already in use
# To stop the server, run servr::daemon_stop(2) or restart your R session
# Serving the directory /Users/st/R/localhost at http://127.0.0.1:7826
Place the address in the browser: http://127.0.0.1:7826
This is not an answer, but some places to get started.
If we run R from terminal (by typing R), then run help.start(), it will start a local host and open it in the browser. On mine, it opens http://127.0.0.1:16371/doc/html/index.html. This at least proves that it's possible to open a localhost in R without any external packages.
I have found some of the code that makes this happen in the R Source Code.