ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

Installing ANTsR with devtools and install_github #317

Closed vnckppl closed 4 years ago

vnckppl commented 4 years ago

Issue I am trying to install ANTsR separately from my general R setup using Packrat.

I use the following script for installing all packages and dependencies:

## * Install Packrat
install.packages("packrat", repos = "http://cran.us.r-project.org")

## * Virtual Environment Location
myvenv <- "/Users/vincent/Data/tmp/venv"
dir.create(myvenv, showWarnings = FALSE)

## * Create Virtual Environment
packrat::init(myvenv)

## * Install ANTsR and dependencies in the virtual environment
# as per: http://stnava.github.io/ANTsR/
# Devtools
install.packages("devtools", repos = "https://repo.miserver.it.umich.edu/cran/")
library("devtools")

# cmaker
install_github("stnava/cmaker")

# ITKR
install_github("stnava/ITKR")

# ANTsR-dependencies
mydeps <- c(
  "magic",
  "psych",
  "rsvd",
  "abind",
  "BGLR",
  "caret",
  "cluster",
  "corpcor",
  "DMwR",
  "dplyr",
  "e1071",
  "extremevalues",
  "fastICA",
  "fpc",
  "ggplot2",
  "glasso",
  "glmnet",
  "hdf5r",
  "igraph",
  "irlba",
  "knitr",
  "MASS",
  "Matrix",
  "mFilter",
  "misc3d",
  "moments",
  "networkD3",
  "pixmap",
  "png",
  "pracma",
  "randomForest",
  "R.matlab",
  "Rcpp",
  "RcppEigen",
  "RcppHNSW",
  "rgl",
  "rmarkdown",
  "robust",
  "robustbase",
  "signal",
  "sna",
  "testthat",
  "viridis",
  "visreg",
  "wmtsa",
  "xgboost",
  "FNN"
)
install.packages(pkgs = mydeps, dependencies = TRUE)

# ANTsR
install_github("stnava/ANTsR")

everything runs fine, until the installation of ANTsR. That returns the following error:

Log

install_github("stnava/ANTsR")
Downloading GitHub repo stnava/ANTsR@master
Downloading GitHub repo ANTsX/ANTsRCore@master
Installing 1 packages: RcppEigen
Installing package into ‘/Users/vincent/Data/tmp/venv/packrat/lib/x86_64-apple-darwin15.6.0/3.6.1’
(as ‘lib’ is unspecified)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4728k  100 4728k    0     0  2226k      0  0:00:02  0:00:02 --:--:-- 2226k

The downloaded binary packages are in
    /var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T//RtmpuciLLU/downloaded_packages
   checking for file ‘/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/RtmpuciLLU/remotes6✔  checking for file ‘/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/RtmpuciLLU/remotes6d8168dd16a9/ANTsX-ANTsRCore-2acba92/DESCRIPTION’
─  preparing ‘ANTsRCore’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘ANTsRCore_0.7.4.6.tar.gz’

Installing package into ‘/Users/vincent/Data/tmp/venv/packrat/lib/x86_64-apple-darwin15.6.0/3.6.1’
(as ‘lib’ is unspecified)
[1] "Loading clear.R"
[1] "Loading html.R"
[1] "Loading myHead.R"
[1] "Loading removeDepends.R"
[1] "Loading showPackages.R"
* installing *source* package ‘ANTsRCore’ ...
** using staged installation
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
darwin18 1
fatal: not a git repository (or any of the parent directories): .git
Cloning into 'ants'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 24475 (delta 3), reused 7 (delta 3), pack-reused 24463
Receiving objects: 100% (24475/24475), 20.39 MiB | 7.92 MiB/s, done.
Resolving deltas: 100% (17450/17450), done.
Already on 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
Note: switching to '8c61a430099e9d5ba580b7255132cfa58a7ee880'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 8c61a430 BUG: Restore number of iterations at final level.
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
CMake Error at /usr/local/Cellar/cmake/3.17.2/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/RtmpdgrNqQ/R.INSTALL6dc020a21a4a/ANTsRCore/src/antb/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_de1e2/fast && make  -f CMakeFiles/cmTC_de1e2.dir/build.make CMakeFiles/cmTC_de1e2.dir/build
    CMakeFiles/cmTC_de1e2.dir/flags.make:6: *** missing separator.  Stop.
    make: *** [cmTC_de1e2/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:66 (project)

-- Configuring incomplete, errors occurred!
See also "/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/RtmpdgrNqQ/R.INSTALL6dc020a21a4a/ANTsRCore/src/antb/CMakeFiles/CMakeOutput.log".
See also "/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/RtmpdgrNqQ/R.INSTALL6dc020a21a4a/ANTsRCore/src/antb/CMakeFiles/CMakeError.log".
CMake Warning:
  Value of CMAKE_CXX_FLAGS contained a newline; truncating

CMake Warning:
  Value of CMAKE_C_FLAGS contained a newline; truncating

** libs
Makevars:3: *** missing separator.  Stop.
ERROR: compilation failed for package ‘ANTsRCore’
* removing ‘/Users/vincent/Data/tmp/venv/packrat/lib/x86_64-apple-darwin15.6.0/3.6.1/ANTsRCore’
Error: Failed to install 'ANTsR' from GitHub:
  Failed to install 'ANTsRCore' from GitHub:
  (converted from warning) installation of package ‘/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T//RtmpuciLLU/file6d8150ad0bf1/ANTsRCore_0.7.4.6.tar.gz’ had non-zero exit status

OS

muschellij2 commented 4 years ago

See https://github.com/ANTsX/ANTsR/issues/291#issuecomment-585422925

vnckppl commented 4 years ago

Hi John, Thanks for your reply. I removed Xcode.App and verified that CommandLineTools is now the selected compiler:

clang++ -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

However, the error (except for the compiler path) remains the same:

> install_github("stnava/ANTsR")
Downloading GitHub repo stnava/ANTsR@master
Downloading GitHub repo ANTsX/ANTsRCore@master
   checking for file ‘/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/R✔  checking for file ‘/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/Rtmpq6VWoh/remotes787d557f0ba0/ANTsX-ANTsRCore-2acba92/DESCRIPTION’
─  preparing ‘ANTsRCore’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘ANTsRCore_0.7.4.6.tar.gz’

Installing package into ‘/Users/vincent/Data/tmp/venv/packrat/lib/x86_64-apple-darwin15.6.0/3.6.1’
(as ‘lib’ is unspecified)
[1] "Loading clear.R"
[1] "Loading html.R"
[1] "Loading myHead.R"
[1] "Loading removeDepends.R"
[1] "Loading showPackages.R"
* installing *source* package ‘ANTsRCore’ ...
** using staged installation
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
darwin18 1
fatal: not a git repository (or any of the parent directories): .git
Cloning into 'ants'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 24475 (delta 3), reused 7 (delta 3), pack-reused 24463
Receiving objects: 100% (24475/24475), 20.39 MiB | 7.54 MiB/s, done.
Resolving deltas: 100% (17450/17450), done.
Already on 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
Note: switching to '8c61a430099e9d5ba580b7255132cfa58a7ee880'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 8c61a430 BUG: Restore number of iterations at final level.
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken
CMake Error at /usr/local/Cellar/cmake/3.17.2/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/Library/Developer/CommandLineTools/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/Rtmpg5gy6b/R.INSTALL78b433507fa4/ANTsRCore/src/antb/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_db7b1/fast && make  -f CMakeFiles/cmTC_db7b1.dir/build.make CMakeFiles/cmTC_db7b1.dir/build
    CMakeFiles/cmTC_db7b1.dir/flags.make:6: *** missing separator.  Stop.
    make: *** [cmTC_db7b1/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:66 (project)

-- Configuring incomplete, errors occurred!
See also "/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/Rtmpg5gy6b/R.INSTALL78b433507fa4/ANTsRCore/src/antb/CMakeFiles/CMakeOutput.log".
See also "/private/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T/Rtmpg5gy6b/R.INSTALL78b433507fa4/ANTsRCore/src/antb/CMakeFiles/CMakeError.log".
CMake Warning:
  Value of CMAKE_CXX_FLAGS contained a newline; truncating

CMake Warning:
  Value of CMAKE_C_FLAGS contained a newline; truncating

** libs
Makevars:3: *** missing separator.  Stop.
ERROR: compilation failed for package ‘ANTsRCore’
* removing ‘/Users/vincent/Data/tmp/venv/packrat/lib/x86_64-apple-darwin15.6.0/3.6.1/ANTsRCore’
Error: Failed to install 'unknown package' from GitHub:
  Failed to install 'ANTsRCore' from GitHub:
  (converted from warning) installation of package ‘/var/folders/pk/t5zt6mt17xb5hzdl2974x_7r0000gn/T//Rtmpq6VWoh/file787d7d4613a/ANTsRCore_0.7.4.6.tar.gz’ had non-zero exit status

I am also getting this error with R 4.0.0.

muschellij2 commented 4 years ago

So Value of CMAKE_CXX_FLAGS contained a newline; truncating looks weird. Says the same thing for CMAKE_C_FLAGS. I would say git clone and run R CMD build locally to try to diagnose.

I'd run ITKR:::itkCompileFlags() and see what you get.

muschellij2 commented 4 years ago

Also what is all this:

[1] "Loading clear.R"
[1] "Loading html.R"
[1] "Loading myHead.R"
[1] "Loading removeDepends.R"
[1] "Loading showPackages.R"

I wouldn't be doing this in a path that has an .Rprofile associated with it unless that's packrat's business.

vnckppl commented 4 years ago

Thanks! Those R functions (which have nothing to do with Packrat) should not have been loaded upon startup. Removing them fixed the building issue. Thanks!!