Search code examples
rdependenciesrstudioinstall.packagesr-car

Error in installing car package in R


While installing "car" package in Rstudio in Ubuntu, I faced an error saying that dependencies "nloptr","lme4" and one more, are not installed. So I started installing "nloptr" but I faced this error-

 configure: Need to download and build NLopt
 trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
 Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-
 2.4.2.tar.gz",  : 
 cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
 Execution halted
 /bin/tar: This does not look like a tar archive

  gzip: stdin: unexpected end of file
  /bin/tar: Child returned status 1
  /bin/tar: Error is not recoverable: exiting now
  Warning message:
  In untar(tarfile = "nlopt-2.4.2.tar.gz") :
  '/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
  configure: Starting to install library to 
  /tmp/RtmpSeLv7g/R.INSTALL18a67910d582/nloptr/nlopt-2.4.2
 ./configure: line 3325: cd: nlopt-2.4.2: No such file or directory

System hangs after last line and when I restart after some time, "nloptr" is not installed and hence I am unable to install "car" package. Please help me. Thanks in advance.


Solution

  • I was encountering the same problem under R (pure R 3.2.3 on Linux Debian). I was first blocked by another issue during the same installation : the installation process failed to lock directory ~/.../R/x86_64.../3.2 and suggested to remove ~/.../R/x86_64.../3.2/00LOCK-nloptr . I did it, restart the car package installation, and then it blocked at the same point: it needs nlopt.h. So, I installed libnlopt-dev (sudo apt-get install libnlopt-dev) and re-restart the car installation ... and then it worked. Ok, this is under linux, but perhaps should you try to focus on installing something about NLOPT under windows. Good luck.