How to install "mxnet" package in R 4.0.2
Asked Answered
E

1

3

Good afternoon. Recently I have encountered the problem with installing "mxnet" package. I have tried several variants of code, but neither of their actually installs this package.

1.

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

And get the error like this:

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

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

Then I type library(mxnet) and get the error message as in p.1.

3.

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

library(devtools)
require(devtools)

install_version("DiagrammeR", version = "0.9.0", repos = "http://cran.us.r-project.org")
require(DiagrammeR)

install.packages("mxnet")
library(mxnet)

After executing this code I get the following error:

ERROR: failed to lock directory 'C:/Users/user/Documents/R/win-library/4.0' for modifying
Try removing 'C:/Users/user/Documents/R/win-library/4.0/00LOCK-rlang'
Error: Failed to install 'unknown package' from URL:
  (converted from warning) installation of package ‘rlang’ had non-zero exit status
> install.packages("mxnet")
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
  unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib:
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES'
Installing package into ‘C:/Users/user/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
  unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib:
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES'
Warning in install.packages :
  package ‘mxnet’ is not available (for R version 4.0.2)
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
  unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0:
  cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES'    

In the end, mxnet package hasn't been installed in RStudio yet.

I have familizrized myself with MXNet package installation in R , but some of the instructions, given there, didn't bring any help. Other coincide with my code.

Could you, please, tell me, how to successfully install this package? What code should I run?

Thank you for your effort.

Exstipulate answered 3/11, 2020 at 17:6 Comment(8)
Especially with packages that have compiled code, often re-installation after loading it can be problematic. You might be able to get away with detaching it and such, but usually I just revert to restarting R completely, and attempt the re-installation before loading it. Not an awesome suggestion, but perhaps it'll work.Nobody
Have you seen this and this?Inarch
@Inarch I have, but it didn't help me. Where should I run, for example, sudo apt-get update and sudo apt-get install -y r-base-core r-cran-devtools libcairo2-dev libxml2-dev? When I run these 2 lines in console in RStudio, I always get errors like: unexpected symbol in...Exstipulate
@Nobody I don't understand the sequence of your actions. What should I do first? How can I reinstall the package? When I restart R session and try to install mxnet package again, I get the same errors, described in my question.Exstipulate
Those two are not commands for R console. They are commands for Linux shell. Are you on a Linux system? @ExstipulateInarch
@Inarch No, Windows.Exstipulate
It seems that you have no prior knowledge of how to compile c++ source code. You may have to learn about doing that because source code is the only thing the official website provides. If you do not want to follow this path, perhaps consider using an older version of R like v3.6.1, which is the latest R build that mxnet currently supports (AFAIK). @ExstipulateInarch
Can someone please take a look at my question? #65496446 thanks!Ringtailed
S
0

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.

This question is duplicate of R: namespace load failed for ‘mxnet’: package ‘mxnet’ was installed before R 4.0.0: please re-install it but can't be flagged as duplicate as there are no accepted answers.

Suh answered 30/12, 2020 at 16:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.