Installing package nloptr

Issues with nloptr

Problem statement

nloptr has released a new major version (2.x) that has changed OS dependencies. They need a more recent version of both NLopt and cmake. nloptr will check if NLopt is installed and in the right version. If not, it will automatically build NLopt within the R package itself. For that it will need cmake in Version >= 3.15. (more information on github.


General Solution

Downgrade nloptr

One of the easiest solutions is to downgrade nloptr to a 1.x version (latest available is

remotes::install_version("nloptr", version = "")

OS specific solutions (in order to keep using nloptr version 2.0)

Ubuntu 16.04 (beaver) and 18.04 (bionic)

Upgrade cmake using the kitware repo.

Ubuntu 20.04 (focal) +

No action needed.


Install cmake3 from the EPEL repository, remove cmake if it is installed and finally create symbolic link ln -s /usr/bin/cmake3 /usr/bin/cmake.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.