Error in installing CAR package in Rstudio



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 ''
Error in download.file(url = "
2.4.2.tar.gz",  : 
cannot open URL ' '
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 
./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. I have updated R version and URL in error is working in browser. Please help me. Thanks in advance.


You may try installing the system nlopt library first as follows:

sudo apt-get install libnlopt-dev

Then install nlopt.


Thanks a lot. It worked now. I wasted my whole day on this.


Hi @amang

As your question has been answered, can you mark it as resolved ? That way, if someone has the problem, the solution is indicated to be here. And it will appears as resolved in the list of questions. thanks !