New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MXNet installation error on mac's R 3.4.0 #6936

Closed
subhomoyghosh opened this Issue Jul 6, 2017 · 13 comments

Comments

Projects
None yet
2 participants
@subhomoyghosh

subhomoyghosh commented Jul 6, 2017

Hi,

I am trying to install the recently released MXNet 0.10.0 on my mac's R from source using the tar.gz file uploaded here. However, I am getting the following error:

install.packages("~/Downloads/mxnet-0.10.0.tar.gz", repos = NULL, type = "source")

Warning in untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
ERROR: cannot extract package from ‘/Downloads/mxnet-0.10.0.tar.gz’
Warning in install.packages :
installation of package ‘
/Downloads/mxnet-0.10.0.tar.gz’ had non-zero exit status

My R's sessionInfo() is the following:

sessionInfo()

R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin16.1.0 (64-bit)
Running under: macOS Sierra 10.12.1
Matrix products: default

BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /usr/local/Cellar/openblas/0.2.19_1/lib/libopenblas_haswellp-r0.2.19.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

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0

I built R with openMP support so that shouldn't be a problem.

Minimum reproducible example

install.packages("~/Downloads/mxnet-0.10.0.tar.gz", repos = NULL, type = "source")

What have you tried to solve it?

I had also tried to install it following this link's suggestion. It resulted in the following error:

install.packages("mxnet")
Installing package into ‘~/Library/R/3.4.0/library’
(as ‘lib’ is unspecified)
trying URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/src/contrib/mxnet_0.10.1.tar.gz'
Warning in install.packages :
cannot open URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/src/contrib/mxnet_0.10.1.tar.gz': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/src/contrib/mxnet_0.10.1.tar.gz'
Warning in install.packages :
download of package ‘mxnet’ failed

Could you please look into the error.

Thanks,
SG

@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 6, 2017

I guess you installed R using brew. There is one key difference between brew and official R.

The R installed from brew will try to install the package from source by default. The R from R project website will try the pre-built pkg first.

Please try

install.packages("mxnet", type = "mac.binary")
@subhomoyghosh

This comment has been minimized.

subhomoyghosh commented Jul 7, 2017

I tried to build it from binary but here is the error I get:

cran <- getOption("repos")
cran["dmlc"] <- "https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/"
options(repos = cran)
cran
CRAN
"https://cran.rstudio.com/"
dmlc
"https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/"
attr(,"RStudio")
[1] TRUE

Regardless of what mirror I choose, I get the same following problem:

install.packages("mxnet", type = "mac.binary")
Installing package into ‘/Users/subhomoy/Library/R/3.4.0/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/3.4/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/3.4/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/macosx/contrib/3.4:
cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/3.4/PACKAGES'
Warning in install.packages :
cannot open URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/bin/macosx/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/bin/macosx/contrib/3.4/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/bin/macosx/contrib/3.4/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/bin/macosx/contrib/3.4:
cannot open URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/bin/macosx/contrib/3.4/PACKAGES'

package ‘mxnet’ is available as a source package but not as a binary

Warning in install.packages :
package ‘mxnet’ is not available (as a binary package for R version 3.4.0)

Thank you for the support.
SG

@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 7, 2017

Can you try install.packages("mxnet", type = "el-capitan.binary")

@subhomoyghosh

This comment has been minimized.

subhomoyghosh commented Jul 8, 2017

It didn't work either. I could install it following one of your other comments using
install.packages("mxnet", type = "mac.binary.el-capitan")

However when I load, it gives me the following error:

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 '/Users/subhomoy/Library/R/3.4.0/library/mxnet/libs/mxnet.so':
dlopen(/Users/subhomoy/Library/R/3.4.0/library/mxnet/libs/mxnet.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
Referenced from: /Users/subhomoy/Library/R/3.4.0/library/mxnet/libs/mxnet.so
Reason: image not found

@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 8, 2017

What is your OS version?

@subhomoyghosh

This comment has been minimized.

subhomoyghosh commented Jul 8, 2017

mac-sierra version 10.12.1

@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 8, 2017

From the error log, R can't find your lapack.

Can you double check that?

@subhomoyghosh

This comment has been minimized.

subhomoyghosh commented Jul 8, 2017

Yes, I tried again and it throws same error. However, I don't find problem installing any other package. How can I fix this?

I see that my directory
/usr/local/Cellar/r/3.4.0_1/R.framework/Versions/3.4/Resources/lib only has libR.dylib libRmath.a and libRmath.dylib. No libRlapack.dylib. Also, the error log shows R is trying to find it in /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib. I built R through brew enabling openblass and openMp support. Not sure exactly what happened?
Is it possible to manually add libRlapack.dylib and possibly symlink it?

@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 13, 2017

I am sorry I don't know a fix for you. My best suggestion is to compile from source.

@subhomoyghosh

This comment has been minimized.

subhomoyghosh commented Jul 16, 2017

Actually, I did try to build it from source following this link's suggestion. I cloned the latest version but whenever I try to build it using

make -j USE_BLAS=openblas USE_OPENCV=0 USE_OPENMP=0 USE_CPP_PACKAGE=1
(I used openblas to build R, so I am using openblas here)

I get the following error:

Makefile:3: *** missing separator. Stop.

I also tried to build it with apple's blas as suggested but I keep getting the same error.

@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 17, 2017

git clone --recursive https://github.com/dmlc/mxnet
cd mxnet
cp make/osx.mk config.mk
make -j$(nproc)
make rpkg
@thirdwing

This comment has been minimized.

Contributor

thirdwing commented Jul 17, 2017

I am sorry that I never used brew to install R. This can be the cause of all errors.

@subhomoyghosh

This comment has been minimized.

subhomoyghosh commented Jul 18, 2017

Thanks for the lead!

I don't why I had some issues with the git repo clone last time. Finally, I fixed these. I had to edit osx.mk to get to work:

export CC = clang-omp
export CXX = clang-omp++
export NVCC = nvcc

and

the additional link flags you want to add

ADD_LDFLAGS ='-L/usr/local/Cellar/openblas/0.2.19_1/lib'

the additional compile flags you want to add

ADD_CFLAGS ='-I/usr/local/Cellar/openblas/0.2.19_1/include'

with OPENMP, OPENCV and openblas (OPENMP=1, OPENCV=1, USE_BLAS=openblas). After adding those paths and correctly specifying compilers, it built mxnet. Rest was the same. I just had to reinstall dplyr after this. The issue is solved.

@thirdwing thirdwing closed this Jul 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment