Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

unable to load mxnet library in R #14004

Open
wittyalias opened this issue Jan 28, 2019 · 5 comments
Open

unable to load mxnet library in R #14004

wittyalias opened this issue Jan 28, 2019 · 5 comments

Comments

@wittyalias
Copy link

wittyalias commented Jan 28, 2019

Looks to be closely related to #13936, and possibly related to the issues in #13952, but I'm not completely sure.

I've followed the instructions to install CPU version of MXNet for R on MacOS (10.14.2).
I successfully install openblas (0.3.5) and opencv (4.0.1) via brew using

brew install opencv
brew install openblas

Also, added the symbolic links as suggested (this is a different openblas version that I have installed):

ln -sf /usr/local/opt/openblas/lib/libopenblas.dylib /usr/local/opt/openblas/lib/libopenblasp-r0.3.1.dylib

And then installed the package within R with:

cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
options(repos = cran)
install.packages("mxnet")

Description

When I try to load the mxnet library I get an error message below

>library(mxnet)
Error: package or namespace load failed for ‘mxnet’:
 .onLoad failed in loadNamespace() for 'mxnet', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mxnet/libs/libmxnet.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mxnet/libs/libmxnet.so, 10): Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.3.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/mxnet/libs/libmxnet.so
  Reason: image not found

Environment info (Required)

I'm using R in RStudio 1.1.463

R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

What have you tried to solve it?

  1. My guess is that its looking for different versions of openblas and opencv than I have installed, so I tried to install a previous versions of them via brew, but I can't figure out how to do it for openblas and 3.4 opencv installs to a folder 'opencv@3' - so the library won't be able to find it anyway.

I did not change the symbolic link because before I had the openblas 0.3.1 error, I had a very similar looking error that said it couldn't find opencv 3.4.

I was thinking of cloning the repository and seeing if I could change what openblas and opencv versions mxnet looks for, but that seems like a lot of work for something that you may already be looking into.

@mxnet-label-bot
Copy link
Contributor

Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended labels: Installation

@frankfliu
Copy link
Contributor

@mxnet-label-bot add [build, R]

@saberioon
Copy link

saberioon commented Feb 17, 2019

I have the same issue, Is there any solution available?

my session info is :

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.3

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] C/UTF-8/C/C/C/C

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0         lubridate_1.7.4    lattice_0.20-35    tidyr_0.8.2
 [5] class_7.3-14       visNetwork_2.0.5   assertthat_0.2.0   digest_0.6.18
 [9] ipred_0.9-8        foreach_1.4.4      R6_2.3.0           plyr_1.8.4
[13] stats4_3.5.1       ggplot2_3.1.0      pillar_1.3.0       rlang_0.3.0.1
[17] lazyeval_0.2.1     caret_6.0-81       rstudioapi_0.8     data.table_1.11.8
[21] kernlab_0.9-27     rpart_4.1-13       Matrix_1.2-14      DiagrammeR_1.0.0
[25] splines_3.5.1      gower_0.1.2        downloader_0.4     readr_1.3.1
[29] stringr_1.3.1      htmlwidgets_1.3    igraph_1.2.2       munsell_0.5.0
[33] compiler_3.5.1     influenceR_0.1.0   rgexf_0.15.3       pkgconfig_2.0.2
[37] htmltools_0.3.6    nnet_7.3-12        tidyselect_0.2.5   tibble_1.4.2
[41] gridExtra_2.3      prodlim_2018.04.18 codetools_0.2-15   XML_3.98-1.16
[45] viridisLite_0.3.0  crayon_1.3.4       dplyr_0.7.8        withr_2.1.2
[49] MASS_7.3-50        recipes_0.1.4      ModelMetrics_1.2.2 grid_3.5.1
[53] jsonlite_1.6       nlme_3.1-137       gtable_0.2.0       magrittr_1.5
[57] pROC_1.13.0        scales_1.0.0       stringi_1.2.4      reshape2_1.4.3
[61] viridis_0.5.1      bindrcpp_0.2.2     timeDate_3043.102  brew_1.0-6
[65] generics_0.0.2     lava_1.6.4         RColorBrewer_1.1-2 iterators_1.0.10
[69] tools_3.5.1        glue_1.3.0         purrr_0.2.5        hms_0.4.2
[73] Rook_1.1-1         survival_2.42-3    colorspace_1.3-2   bindr_0.1.1
>

@drag05
Copy link

drag05 commented Feb 4, 2020

I have installed mxnet for CPU and worked fine on Windows 10, R version 3.6.2. Then I wanted to try mxnet for GPU: I installed mxnet for GPU using the command:

install.packages("https://s3.ca-central-1.amazonaws.com/jeremiedb/share/mxnet/GPU/mxnet.zip", repos = NULL)

everything went file. However when trying to load in R version 3.6.2 or R Studio, I get the following error:

Loading required package: mxnet

Error: package or namespace load failed for ‘mxnet’: .onLoad failed in loadNamespace() for 'mxnet', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object 'C:/R/R-3.6.2/library/mxnet/libs/x64/libmxnet.dll': LoadLibrary failure: The specified module could not be found.

I have been using my GPU for R/keras/tensorflow having installed cuda100 on miniconda3. It works quite smoothly on NVIDIA Geforce RTX 2080

Please advise

In case this helps:

> sessionInfo()

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:

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

loaded via a namespace (and not attached):
[1] htmlwidgets_1.5.1 DiagrammeR_1.0.5 compiler_3.6.2 magrittr_1.5 visNetwork_2.0.9
[6] htmltools_0.4.0 tools_3.6.2 glue_1.3.1 RColorBrewer_1.1-2 Rcpp_1.0.3
[11] stringi_1.4.5 stringr_1.4.0 jsonlite_1.6.1 digest_0.6.23 rlang_0.4.4

Thank you!

@sbar365
Copy link

sbar365 commented Apr 3, 2020

I am also trying to install mxnet for R on MacOS (10.15.4). I installed openblas 0.3.9 and opencv 4.2.0_3.

cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
options(repos = cran)
install.packages("mxnet")
library(mxnet)

and I get the following error:

[1] "Loading local: inst/libs/libmxnet.so"
Error: package or namespace load failed for ‘mxnet’:
.onLoad failed in loadNamespace() for 'mxnet', details:
call: dyn.load("R-package/inst/libs/libmxnet.so", local = FALSE)
error: unable to load shared object '/Users/Stefanos/R-package/inst/libs/libmxnet.so':
dlopen(/Users/Stefanos/R-package/inst/libs/libmxnet.so, 10): image not found

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.15.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] devtools_2.2.2 usethis_1.5.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.4 tidyr_1.0.2 prettyunits_1.1.1 ps_1.3.2 visNetwork_2.0.9 assertthat_0.2.1
[7] rprojroot_1.3-2 digest_0.6.25 R6_2.4.1 backports_1.1.5 ggplot2_3.3.0 pillar_1.4.3
[13] rlang_0.4.5 rstudioapi_0.11 callr_3.4.3 drat_0.1.5 DiagrammeR_0.9.2 desc_1.2.0
[19] downloader_0.4 servr_0.16 readr_1.3.1 stringr_1.4.0 htmlwidgets_1.5.1 igraph_1.2.5
[25] munsell_0.5.0 compiler_3.5.2 influenceR_0.1.0 rgexf_0.16.0 httpuv_1.5.2 xfun_0.12
[31] pkgconfig_2.0.3 pkgbuild_1.0.6 htmltools_0.4.0 tidyselect_1.0.0 tibble_3.0.0 gridExtra_2.3
[37] XML_3.99-0.3 fansi_0.4.1 viridisLite_0.3.0 crayon_1.3.4 dplyr_0.8.5 withr_2.1.2
[43] later_1.0.0 grid_3.5.2 jsonlite_1.6.1 gtable_0.3.0 lifecycle_0.2.0 magrittr_1.5
[49] scales_1.1.0 neuralnet_1.44.2 cli_2.0.2 stringi_1.4.6 viridis_0.5.1 fs_1.3.2
[55] promises_1.1.0 remotes_2.1.1 testthat_2.3.2 ellipsis_0.3.0 vctrs_0.2.4 RColorBrewer_1.1-2
[61] tools_3.5.2 glue_1.3.2 purrr_0.3.3 hms_0.5.3 processx_3.4.2 pkgload_1.0.2
[67] yaml_2.2.1 colorspace_1.4-1 sessioninfo_1.1.1 memoise_1.1.0

Any ideas how to fix this issue?
Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants