How to install R package from github manually or offline

I am trying to download the tsdyn package from github (it has not yet been updated on the tap), but my proxy server does not allow me to connect to github.

library(devtools) install_github("MatthieuStigler/tsDyn", ref="Dev94", subdir="tsDyn") Downloading github repo MatthieuStigler/ tsDyn@Dev94 Erreur dans function (type, msg, asError = TRUE) : Failed to connect to api.github.com port 443: Connection refused 

Then I downloaded .zip and tried to install the package from .zip and got this error:

 Erreur dans read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : impossible d'ouvrir la connexion De plus : Message d'avis : In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : impossible d'ouvrir le fichier compressé 'tsDyn-master/DESCRIPTION', cause probable : 'No such file or directory' 

I do not understand, since I can find the DESCRIPTION file in the repository. I think he is trying to connect to the Internet, which is not allowed by my professional connection. I found that some people with Linux managed to load them with a port other than 443 (port 8000 should be allowed, I think, but not sure), but I have windows 7. I have administrator credentials and it doesn’t work, when I try to use R as an administrator. I really don’t know anything about setting up a proxy server, so if you have any ideas, please try to be more specific regarding the actions that I should do.

Thank you very much in advance!

Edit1: I tried your suggestion and deleted the unnecessary level in the file repository, I did

 Rscript -e "install.packages ('C:/Users/stephanie/Downloads/tsDyn.zip',repos=NULL) " 

and I received from the terminal "Installing the package in C: /Users/stephanie/Documents/R/win-library/3.1" (since "lib" is not specified). It seemed to work, but when I use the library command (tsDyn ) in RI received "Erreur dans library (tsDyn)", "tsDyn" n'est pas un nom correct de install installé "(this is not the correct name of the installed package in English, I think). Although the files exist in the win-library, but I noticed that the MD5 and INDEX files, which are always present in other package directories, are missing here. Idea?

Edit2: I found a solution by uninstalling as indicated at an unnecessary level, I used the following devtools install function and worked (offline) ...

 library(devtools) install("C:/Users/stephanie/Downloads/tsDyn") 

I really don't understand the difference with the terminal team, so if someone can give me a hint, I solved my pb, but I would be interested to understand how to do it!

+5
source share
2 answers

Or move everything one level so that you do not have an intermediate folder named tsDyn , and then:

 install_github("MatthieuStigler/tsDyn") 

Or leave things as they are, and

 install_github("MatthieuStigler/tsDyn/tsDyn") 

The proof is in the pudding

 library(devtools) install_github("MatthieuStigler/tsDyn/tsDyn") # Downloading github repo MatthieuStigler/ tsDyn@master # Installing tsDyn # "C:/PROGRA~1/R/R-31~1.2/bin/x64/R" --vanilla CMD INSTALL \ # "C:/Users/dominic/AppData/Local/Temp/RtmpiwFHUz/devtools30d0779d2870/MatthieuStigler-tsDyn-8048816/tsDyn" \ # --library="D:/Copy/R/win-library/3.1" --install-tests # # * installing *source* package 'tsDyn' ... # ** libs # # *** arch - i386 # gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c llar.c -o llar.o # gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c misc.c -o misc.o # gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c search.c -o search.o # gcc -m32 -shared -s -static-libgcc -o tsDyn.dll tmp.def llar.o misc.o search.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.2/bin/i386 -lR # installing to D:/Copy/R/win-library/3.1/tsDyn/libs/i386 # # *** arch - x64 # gcc -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c llar.c -o llar.o # gcc -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c misc.c -o misc.o # gcc -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c search.c -o search.o # gcc -m64 -shared -s -static-libgcc -o tsDyn.dll tmp.def llar.o misc.o search.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.2/bin/x64 -lR # installing to D:/Copy/R/win-library/3.1/tsDyn/libs/x64 # ** R # ** data # ** inst # ** tests # ** preparing package for lazy loading # ** help # *** installing help indices # ** building package indices # ** installing vignettes # ** testing if installed package can be loaded # *** arch - i386 # *** arch - x64 # * DONE (tsDyn) library(tsDyn) tsDyn::autopairs # function (x, lag = 1, h, type = c("levels", "persp", "image", # "lines", "points", "regression")) # { # panel <- list(levels = function() sm::sm.density(X, h = rep(h, # 2), xlab = xlab, ylab = ylab, main = "density", display = "slice"), # persp = function() sm::sm.density(X, h = rep(h, 2), xlab = xlab, # ylab = ylab, main = "density", display = "persp"), # image = function() sm::sm.density(X, h = rep(h, 2), xlab = xlab, # ylab = ylab, main = "density", display = "image"), # lines = function() plot(X, xlab = xlab, ylab = ylab, # main = "lines", type = "l"), points = function() plot(X, # xlab = xlab, ylab = ylab, main = "scatter"), regression = function() sm::sm.regression(X[, # 1], X[, 2], h = h, xlab = xlab, ylab = ylab, main = "regression", # ask = FALSE)) # lags <- c(-lag, 0) # X <- embedd(x, lags = lags) # xlab <- paste("lag", lag) # ylab <- paste("lag", 0) # type <- match.arg(type) # if (missing(h)) { # h <- sm::hnorm(X)[1] # } # panel[[type]]() # } # <environment: namespace:tsDyn> 
+1
source

You can avoid this by setting up a proxy server when working behind a firewall. For instructions on setting up a proxy server from Rstudio, see Link .

  • Consult with your IT administrator, which proxy server should you use to access anything HTTP / HTTPS on the internal network? In most cases, this would be HTTP - http: //proxy.companydomain: 8080 HTTPS - https: //proxy.companydomain: 8080
  • Locate the Renviron.site file. One of my windows is 10, I found it in C:\Users\yourid\Documents\R\R-3.4.3\etc On Linux, this is changing.
  • Open Renviron.site with a text editor and paste your proxy. save the file and restart R

      options(Internet.info = 0) http_proxy=http://proxy.companydomain:8080/ https_proxy=https://proxy.companydomain:8080/ 
  • In my case, I had another error after setting up the proxy server, which is unsupported proxy ....libcurl is built without the HTTPS-proxy support. . Therefore, I changed the second line to http:// instead of https:// . This worked without errors.

     https_proxy=http://proxy.companydomain:8080/ 

    Hope this helps. It’s a bit easy to set up a proxy server and let everything happen automatically.

+1
source

Source: https://habr.com/ru/post/1216601/


All Articles