shiny icon indicating copy to clipboard operation
shiny copied to clipboard

LoadLibrary failure for httpuv.dll when trying to run shiny

Open JDDEVENE opened this issue 9 months ago • 4 comments

I have some R code that I was running on a shared cloud (Windows Server 2016 x64) for several months. Now, when I try to run the app I get the following error:

library(shiny); runApp('DRO Tool V4.R') Error: package or namespace load failed for ‘shiny’ in inDL(x, as.logical(local), as.logical(now), ...): unable to load shared object 'C:/Users/jdevenezia003/AppData/Local/R/win-library/4.4/httpuv/libs/x64/httpuv.dll': LoadLibrary failure: The specified procedure could not be found.

I tried reinstalling httpuv, shiny, and rcpp but I still get the same error. I also tried updating packages, and removing all packages and then reinstalling them.

Here is my sessionInfo: sessionInfo() R version 4.4.3 (2025-02-28 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2016 x64 (build 14393)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

time zone: Etc/UTC tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] compiler_4.4.3 tools_4.4.3

JDDEVENE avatar Mar 26 '25 13:03 JDDEVENE

What happens if you just do this?

library(httpuv)

It's possible that your installation of httpuv is corrupted somehow. When you reinstall it (and other packages), please make sure that you have stopped all R sessions, because on Windows, if a DLL is loaded in one running program, the system will prevent the DLL from being deleted and replaced by a new one.

Similar issue here: https://github.com/rstudio/shiny/issues/2030#issuecomment-383144033

Another possibility (from here) is to reinstall with --no-multiarch:

install.packages("httpuv",INSTALL_opts="--no-multiarch")

wch avatar Mar 26 '25 18:03 wch

Hello, when I do library(httpuv) I get the same error as above. By stopping all R sessions, do you mean any that are open in the server as well? I tried the other install with --no-multiarch

`> install.packages("httpuv",INSTALL_opts="--no-multiarch") Installing package into ‘C:/Users/jdevenezia003/AppData/Local/R/win-library/4.4’ (as ‘lib’ is unspecified) also installing the dependencies ‘rlang’, ‘fastmap’, ‘magrittr’, ‘later’, ‘promises’, ‘R6’, ‘Rcpp’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/rlang_1.1.5.zip' Content type 'application/zip' length 1632058 bytes (1.6 MB) downloaded 1.6 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/fastmap_1.2.0.zip' Content type 'application/zip' length 135640 bytes (132 KB) downloaded 132 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/magrittr_2.0.3.zip' Content type 'application/zip' length 230035 bytes (224 KB) downloaded 224 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/later_1.4.1.zip' Content type 'application/zip' length 468183 bytes (457 KB) downloaded 457 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/promises_1.3.2.zip' Content type 'application/zip' length 2019481 bytes (1.9 MB) downloaded 1.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/R6_2.6.1.zip' Content type 'application/zip' length 88720 bytes (86 KB) downloaded 86 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/Rcpp_1.0.14.zip' Content type 'application/zip' length 2901133 bytes (2.8 MB) downloaded 2.8 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/httpuv_1.6.15.zip' Content type 'application/zip' length 1010055 bytes (986 KB) downloaded 986 KB

package ‘rlang’ successfully unpacked and MD5 sums checked package ‘fastmap’ successfully unpacked and MD5 sums checked package ‘magrittr’ successfully unpacked and MD5 sums checked Warning in install.packages : cannot remove prior installation of package ‘magrittr’ Warning in install.packages : problem copying C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\00LOCK\magrittr\libs\x64\magrittr.dll to C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\magrittr\libs\x64\magrittr.dll: Permission denied Warning in install.packages : restored ‘magrittr’ package ‘later’ successfully unpacked and MD5 sums checked Warning in install.packages : cannot remove prior installation of package ‘later’ Warning in install.packages : problem copying C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\00LOCK\later\libs\x64\later.dll to C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\later\libs\x64\later.dll: Permission denied Warning in install.packages : restored ‘later’ package ‘promises’ successfully unpacked and MD5 sums checked Warning in install.packages : cannot remove prior installation of package ‘promises’ Warning in install.packages : problem copying C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\00LOCK\promises\libs\x64\promises.dll to C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\promises\libs\x64\promises.dll: Permission denied Warning in install.packages : restored ‘promises’ package ‘R6’ successfully unpacked and MD5 sums checked package ‘Rcpp’ successfully unpacked and MD5 sums checked Warning in install.packages : cannot remove prior installation of package ‘Rcpp’ Warning in install.packages : problem copying C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\00LOCK\Rcpp\libs\x64\Rcpp.dll to C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\Rcpp\libs\x64\Rcpp.dll: Permission denied Warning in install.packages : restored ‘Rcpp’ package ‘httpuv’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\jdevenezia003\AppData\Local\Temp\4\RtmpMxDU67\downloaded_packages

library(httpuv) Error: package or namespace load failed for ‘httpuv’ in inDL(x, as.logical(local), as.logical(now), ...): unable to load shared object 'C:/Users/jdevenezia003/AppData/Local/R/win-library/4.4/httpuv/libs/x64/httpuv.dll': LoadLibrary failure: The specified procedure could not be found.`

JDDEVENE avatar Mar 26 '25 19:03 JDDEVENE

Warning in install.packages :
problem copying C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\00LOCK\later\libs\x64\later.dll to 
C:\Users\jdevenezia003\AppData\Local\R\win-library\4.4\later\libs\x64\later.dll: Permission denied

This error is common on Windows when the package being installed is in use in another session, so yes, it might require shutting down other R sessions. Another option is to try using the pak package to install httpuv, since pak is designed to handle this better on Windows: pak::pak("httpuv")

gadenbuie avatar Mar 26 '25 20:03 gadenbuie

I asked around people on the server to close the code and now I no longer get those warning for installing packages, but the same

library(httpuv)

error persists. I removed all packages and then tried to reinstall httpuv again using "--no-multiarch"


> install.packages("httpuv",INSTALL_opts="--no-multiarch")
Installing package into ‘C:/Users/jdevenezia003/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘rlang’, ‘fastmap’, ‘magrittr’, ‘later’, ‘promises’, ‘R6’, ‘Rcpp’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/rlang_1.1.5.zip'
Content type 'application/zip' length 1632058 bytes (1.6 MB)
downloaded 1.6 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/fastmap_1.2.0.zip'
Content type 'application/zip' length 135640 bytes (132 KB)
downloaded 132 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/magrittr_2.0.3.zip'
Content type 'application/zip' length 230035 bytes (224 KB)
downloaded 224 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/later_1.4.1.zip'
Content type 'application/zip' length 468183 bytes (457 KB)
downloaded 457 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/promises_1.3.2.zip'
Content type 'application/zip' length 2019481 bytes (1.9 MB)
downloaded 1.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/R6_2.6.1.zip'
Content type 'application/zip' length 88720 bytes (86 KB)
downloaded 86 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/Rcpp_1.0.14.zip'
Content type 'application/zip' length 2901133 bytes (2.8 MB)
downloaded 2.8 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/httpuv_1.6.15.zip'
Content type 'application/zip' length 1010055 bytes (986 KB)
downloaded 986 KB

package ‘rlang’ successfully unpacked and MD5 sums checked
package ‘fastmap’ successfully unpacked and MD5 sums checked
package ‘magrittr’ successfully unpacked and MD5 sums checked
package ‘later’ successfully unpacked and MD5 sums checked
package ‘promises’ successfully unpacked and MD5 sums checked
package ‘R6’ successfully unpacked and MD5 sums checked
package ‘Rcpp’ successfully unpacked and MD5 sums checked
package ‘httpuv’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\jdevenezia003\AppData\Local\Temp\4\RtmpigHd2p\downloaded_packages
> library(httpuv)
Error: package or namespace load failed for ‘httpuv’ in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Users/jdevenezia003/AppData/Local/R/win-library/4.4/httpuv/libs/x64/httpuv.dll':
  LoadLibrary failure:  The specified procedure could not be found.

In addition, the using pak gives me the following error:

> pak::pak("httpuv")
v Loading metadata database ... done
Error:  5  deps for  1/1  pkgs [|] Done                                   
! error in pak subprocess
Caused by error in `value$ref %in% private$state$ref && !value$direct`:
! 'length = 4' in coercion to 'logical(1)'
Type .Last.error to see the more details.

JDDEVENE avatar Mar 26 '25 20:03 JDDEVENE