1

I am trying to install.packages("badger") in R 4.2.0 (ubuntu 20.04). But it says error 407 when it downloads some file:

.....
* installing *source* package 'gert' ...
** package 'gert' successfully unpacked and MD5 sums checked
** using staged installation
> curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh","get-libgit2-linux.sh")
Error in curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh",  : 
  Received HTTP code 407 from proxy after CONNECT
Execution halted
Using PKG_CFLAGS=
Using PKG_LIBS=-lgit2
......

However:

  • All other packages are installed perfectly fine.
  • This exact file is also downloaded fine both in browser and in command line curl https://r-lib.github.io/gert/get-libgit2-linux.sh both from root and user.
  • This file gives the same error when i enter curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh","index.html") in the R prompt.
  • But curl::curl_download("https://github.com","index.html") works fine.
  • But curl::curl_download("https://google.com","index.html") gives the same error 407.
  • When i set the proxy server with Sys.setenv(https_proxy = ) and Sys.setenv(https_proxy_user = ), it does not help downloading the mentioned file with curl, moreover, the installation ends at even earlier stage saying:
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
  cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
Warning message:
package 'badger' is not available for this version of R
  • When i unset https_proxy and http_proxy variables in bash, the installation freezes trying to download the index cos our company uses proxy server and there is no internet access without it:
> install.packages("badger")
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
^C
  • When i both unset the proxy settings in bash and set them in R, the curl invocation gives the same error 407, and the installation says:
> install.packages("badger")
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
Error in readRDS(dest) : error reading from connection

What could it be and how can i get the curl working? Or how can i install the mentioned package without curl?

Thanks in advance.

1 Answers1

0

Error indicates, proxy is not set properly or the proxy settings expired for some reasons. The latter was the case for me, on OpenSuse.

Solution:

  • check by running yast, through terminal. This shall open Terminal UI view, where you can navigate to setup and test the "network proxy" and "network proxy user" settings.

OR

  • Alternately: Yast creates a file named ~/.curlrc. Edit this, for setting your proxy and proxy-users here. Open new bash/session to validate changes.

Test using, zypper refresh command on terminal.

NOTE (OPTIONAL): Other possible catch had been - some of the old repo-URLs were not reachable. which probably would need to be disabled until you have updated zypper as zypper update. For Example:

$ ls /etc/zypp/repos.d/
$ vi suse_update.repo

<Edit, to replace enabled=1 by enabled=0>

4MoreInfo:

Update Process Using Curl Does Not Access the Configured Proxy Server

Baseurl entries in repo files

SUSE Linux Enterprise : How to setup a Proxy manually

parasrish
  • 3,864
  • 26
  • 32