3

I am trying to install factoextra, but I gets stuck during the CMake part, in particular with error like:

CMake Error: The source directory "/tmp/..." does not exist.

(same when I try to install its dependencies: nloptr, pbkrtest, lme4, car, rstatix, FactoMineR, ggpubr )

any idea?

thanks

ps:

  • R version 4.0.0
  • centos 7

last part of logs:

CMake Error: The source directory "/tmp/RtmpgJySdf/R.INSTALL20c31df42f6/nloptr/src/nlopt-build" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Unknown argument -j
Unknown argument 2
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
  <dir>          = Project binary directory to be built.
  --target <tgt> = Build <tgt> instead of default targets.
  --config <cfg> = For multi-configuration tools, choose <cfg>.
  --clean-first  = Build target 'clean' first, then build.
                   (To clean only, use --target 'clean'.)
  --use-stderr   = Don't merge stdout/stderr output and pass the
                   original stdout/stderr handles to the native
                   tool so it can use the capabilities of the
                   calling terminal (e.g. colored output).
  --             = Pass remaining options to the native tool.
CMake Error: The source directory "/tmp/RtmpgJySdf/R.INSTALL20c31df42f6/nloptr/src/nlopt" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
cp: cannot stat 'nlopt/include/*': No such file or directory
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I"/opt/R/4.0.0/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.0.0/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c init_nloptr.c -o init_nloptr.o
gcc -std=gnu99 -I"/opt/R/4.0.0/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.0.0/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c nloptr.c -o nloptr.o
g++ -std=gnu++11 -I"/opt/R/4.0.0/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.0.0/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c test-C-API.cpp -o test-C-API.o
g++ -std=gnu++11 -I"/opt/R/4.0.0/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.0.0/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/opt/R/4.0.0/lib/R/lib -L/usr/local/lib -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -L/opt/R/4.0.0/lib/R/lib -lRlapack -L/opt/R/4.0.0/lib/R/lib -lRblas -lgfortran -lm -lquadmath -Lnlopt/lib -lnlopt -L/opt/R/4.0.0/lib/R/lib -lR
/bin/ld: cannot find -lnlopt
collect2: error: ld returned 1 exit status
make: *** [nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/opt/R/4.0.0/lib/R/library/nloptr’
ERROR: dependency ‘nloptr’ is not available for package ‘lme4’
* removing ‘/opt/R/4.0.0/lib/R/library/lme4’
ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
* removing ‘/opt/R/4.0.0/lib/R/library/pbkrtest’
ERROR: dependencies ‘pbkrtest’, ‘lme4’ are not available for package ‘car’
* removing ‘/opt/R/4.0.0/lib/R/library/car’
ERROR: dependency ‘car’ is not available for package ‘rstatix’
* removing ‘/opt/R/4.0.0/lib/R/library/rstatix’
ERROR: dependency ‘car’ is not available for package ‘FactoMineR’
* removing ‘/opt/R/4.0.0/lib/R/library/FactoMineR’
ERROR: dependency ‘rstatix’ is not available for package ‘ggpubr’
* removing ‘/opt/R/4.0.0/lib/R/library/ggpubr’
ERROR: dependencies ‘FactoMineR’, ‘ggpubr’ are not available for package ‘factoextra’
* removing ‘/opt/R/4.0.0/lib/R/library/factoextra’

The downloaded source packages are in
    ‘/tmp/Rtmp98DJqK/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages("factoextra") :
  installation of package ‘nloptr’ had non-zero exit status
2: In install.packages("factoextra") :
  installation of package ‘lme4’ had non-zero exit status
3: In install.packages("factoextra") :
  installation of package ‘pbkrtest’ had non-zero exit status
4: In install.packages("factoextra") :
  installation of package ‘car’ had non-zero exit status
5: In install.packages("factoextra") :
  installation of package ‘rstatix’ had non-zero exit status
6: In install.packages("factoextra") :
  installation of package ‘FactoMineR’ had non-zero exit status
7: In install.packages("factoextra") :
  installation of package ‘ggpubr’ had non-zero exit status
8: In install.packages("factoextra") :
  installation of package ‘factoextra’ had non-zero exit status
jjrr
  • 1,038
  • 2
  • 13
  • 26
  • may be related to https://stackoverflow.com/questions/62548358/installing-factoextra-package-in-r – jjrr Feb 24 '22 at 10:08
  • 1
    R 3.6.0 was released nearly 3 years ago. Can you update to a more recent version? It might be that there's an unstated dependency on a current release. – user2554330 Feb 24 '22 at 11:25
  • Do you have environment variables telling it where your temp dir is? – user2554330 Feb 24 '22 at 11:25
  • unfortunately updating to R 4.0.0 did not solve the issue @user2554330 – jjrr Feb 24 '22 at 15:28
  • and yes, there is R_SESSION_TMPDIR /tmp/Rtmp98DJqK – jjrr Feb 24 '22 at 15:32
  • It doesn't look like the problem is with R, so R_SESSION_TMPDIR wouldn't be relevant. Likely CMake or some tool it calls needs a temporary directory, and it's not finding one. Does the directory it listed actually exist? You only told us `/tmp/...`. Re the version: x.0.0 is always a scary version to use; the last in the 4.0 series was 4.0.5. But that's probably not the issue here, since 4.0.0 should be new enough. – user2554330 Feb 24 '22 at 15:41
  • yes, I also do not think it's a v. issue ... -- and yes, that directory does exist – jjrr Feb 24 '22 at 15:52
  • Those two errors `Unknown argument -j` and `Unknown argument 2` are likely relevant: `-j 2` is a common argument to GNU make, but I guess not for `CMake`. So you should figure out why it is being passed to it. – user2554330 Feb 24 '22 at 18:00
  • I managed to get some progress with cmake3 https://github.com/astamm/nloptr/issues/104#issuecomment-1034229550 -- but I am stuck at https://github.com/astamm/nloptr/issues/104#issuecomment-1057145505 – jjrr Mar 09 '22 at 08:33

3 Answers3

4

I solved this problem by sudo apt-get install libnlopt-dev.

Wayne
  • 113
  • 9
  • apart the fact the I am on CentOS (yum install nlopt-devel) this does not solve the issue for me -- it installs a previous v. < 3 (see also my lastest comment, on cmake3) – jjrr Mar 09 '22 at 08:38
4

so,

I think I finally figure out!
factoextra (or better, nloptr) currently needs a combination of

jjrr
  • 1,038
  • 2
  • 13
  • 26
1

In Ubuntu install cmake v3.20.2 from the source and it will solve the issue:

sudo apt install build-essential libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz
tar -zxvf cmake-3.20.2.tar.gz
cd cmake-3.20.2
./bootstrap
make 
sudo make install 
mpiroozn
  • 11
  • 1