R: namespace load failed for ‘mxnet’: package ‘mxnet’ was installed before R 4.0.0: please re-install it
Asked Answered
H

1

0

I am trying to install the R package "mxnet". However, this package does not seem to be available on CRAN. I found similar posts on stackoveflow where similar problems were encountered:

How to install "mxnet" package in R 4.0.2

I tried to install this package three different ways, but both of them failed:

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

Installing package into ‘C:/Users/me/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip'
Content type 'application/zip' length 29498166 bytes (28.1 MB)
downloaded 28.1 MB

 library(mxnet)
Error: package or namespace load failed for ‘mxnet’:
 package ‘mxnet’ was installed before R 4.0.0: please re-install it


#second way

> install.packages("https://jeremiedb.s3.ca-central-1.amazonaws.com/share/mxnet/GPU/1.5.1/mxnet.zip", repos = NULL)
Installing package into ‘C:/Users/me/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://jeremiedb.s3.ca-central-1.amazonaws.com/share/mxnet/GPU/1.5.1/mxnet.zip'
Warning in install.packages :
  cannot open URL 'https://jeremiedb.s3.ca-central-1.amazonaws.com/share/mxnet/GPU/1.5.1/mxnet.zip': HTTP status was '404 Not Found'

Error in download.file(p, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://jeremiedb.s3.ca-central-1.amazonaws.com/share/mxnet/GPU/1.5.1/mxnet.zip'


#third way:
install.packages("https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip", repos = NULL)

> install.packages("https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip", repos = NULL)
Installing package into ‘C:/Users/me/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip'
Content type 'application/zip' length 29498166 bytes (28.1 MB)
downloaded 28.1 MB

 library(mxnet)
Error: package or namespace load failed for ‘mxnet’:
 package ‘mxnet’ was installed before R 4.0.0: please re-install it

Does anyone know if this package is still available?

Thanks

note - here is my session info:

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

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

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

other attached packages:
 [1] RSNNS_0.4-12      Rcpp_1.0.5        quantmod_0.4.17   TTR_0.24.2        xts_0.12.1       
 [6] plotly_4.9.2.1    data.table_1.12.8 ranger_0.12.1     survival_3.2-7    xgboost_1.1.1.1  
[11] dynlm_0.3-6       zoo_1.8-8         caret_6.0-86      ggplot2_3.3.2     lattice_0.20-41  
[16] dplyr_1.0.0       timetk_2.6.0      PoEdata_0.1.0     devtools_2.3.2    usethis_1.6.3    
[21] tseries_0.10-47  

loaded via a namespace (and not attached):
  [1] colorspace_1.4-1     ellipsis_0.3.1       class_7.3-17         rio_0.5.16          
  [5] rprojroot_1.3-2      fs_1.4.2             rstudioapi_0.11      listenv_0.8.0       
  [9] furrr_0.2.0          farver_2.0.3         remotes_2.2.0        dials_0.0.9         
 [13] prodlim_2019.11.13   fansi_0.4.1          lubridate_1.7.9      codetools_0.2-16    
 [17] splines_4.0.2        pkgload_1.1.0        jsonlite_1.7.1       workflows_0.2.1     
 [21] pROC_1.16.2          yardstick_0.0.7      tune_0.1.1           httr_1.4.2          
 [25] readr_1.3.1          compiler_4.0.2       backports_1.1.7      assertthat_0.2.1    
 [29] Matrix_1.2-18        lazyeval_0.2.2       cli_2.1.0            htmltools_0.5.0     
 [33] prettyunits_1.1.1    tools_4.0.2          gtable_0.3.0         glue_1.4.1          
 [37] reshape2_1.4.4       tinytex_0.26         carData_3.0-4        cellranger_1.1.0    
 [41] fracdiff_1.5-1       DiceDesign_1.8-1     vctrs_0.3.2          urca_1.3-0          
 [45] nlme_3.1-149         crosstalk_1.1.0.1    iterators_1.0.13     parsnip_0.1.3       
 [49] lmtest_0.9-38        timeDate_3043.102    gower_0.2.2          xfun_0.15           
 [53] stringr_1.4.0        globals_0.13.1       ps_1.3.3             openxlsx_4.2.2      
 [57] testthat_2.3.2       lifecycle_0.2.0      future_1.19.1        MASS_7.3-53         
 [61] scales_1.1.1         ipred_0.9-9          hms_0.5.3            parallel_4.0.2      
 [65] yaml_2.2.1           curl_4.3             memoise_1.1.0        rpart_4.1-15        
 [69] stringi_1.4.6        desc_1.2.0           foreach_1.5.1        lhs_1.1.1           
 [73] zip_2.1.1            pkgbuild_1.1.0       lava_1.6.8           rlang_0.4.7         
 [77] pkgconfig_2.0.3      rsample_0.0.8        purrr_0.3.4          htmlwidgets_1.5.2   
 [81] recipes_0.1.13       labeling_0.3         processx_3.4.4       tidyselect_1.1.0    
 [85] plyr_1.8.6           magrittr_1.5         R6_2.4.1             generics_0.0.2      
 [89] haven_2.3.1          foreign_0.8-80       pillar_1.4.6         withr_2.3.0         
 [93] abind_1.4-5          nnet_7.3-14          tibble_3.0.3         crayon_1.3.4        
 [97] car_3.0-10           utf8_1.1.4           readxl_1.3.1         grid_4.0.2          
[101] callr_3.5.1          git2r_0.27.1         forcats_0.5.0        ModelMetrics_1.2.2.2
[105] forecast_8.13        digest_0.6.25        tidyr_1.1.0          stats4_4.0.2        
[109] munsell_0.5.0        GPfit_1.0-8          viridisLite_0.3.0    sessioninfo_1.1.1   
[113] quadprog_1.5-8
Holusbolus answered 29/12, 2020 at 17:7 Comment(4)
After install.packages (either attempt), try restarting R (fresh session!) before attempting to library(mxnet) again.Antigone
Still doesn't work :(Holusbolus
Several of the issues (when I googled cran mxnet) suggested having to install from source. Have you tried that? (This suggest a non-zip file, typically .tar.gz or .tgz, would require Rtools40 installed at a minimum. I have no experience with mxnet, so this is the best I can do. Good luck!)Antigone
Thanks for all your help! I will try that right nowHolusbolus
P
1

As there is no prebuilt MXNet binary available for the version of R that you are using, you will need to follow the build from source instructions. Please see https://mxnet.apache.org/versions/1.7.0/get_started/build_from_source

You can follow these instructions but use the 1.8.0rc2 release archive instead of 1.7.0 if you like.

Purslane answered 30/12, 2020 at 15:48 Comment(1)
thank you for your reply! Since I already have R and devtools on my computer, I skipped the first step (sudo apt-get update sudo apt-get install -y r-base-core r-cran-devtools libcairo2-dev libxml2-dev ). Then, I entered "install.packages("roxygen2")" and this library was installed. However, when I entered the last line of code "make -f R-package/Makefile rpkg" , I got the following error: " make -f R-package/Makefile rpkg Error: unexpected symbol in "make -f R". Do you know what I am doing wrong? Thank you for all your heloHolusbolus

© 2022 - 2024 — McMap. All rights reserved.