Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

install.packages('curl') fails because libcurl is not found on Ubuntu

ErrorConfiguration failed because libcurl was not found.

Short answer

R packages that bind to curl compile against the libcurl headers, which the normal runtime library does not include. On Ubuntu and Debian install libcurl4-openssl-dev, then retry the install. If that is already present, check that the installed libcurl meets the version the package asks for.

  • Applies to R 4.x, Ubuntu 24.04, Debian 12
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the system whether the libcurl development files are there. If curl-config is missing or reports an old version, the build cannot find what it needs.

    curl-config --version
    dpkg -l | grep libcurl
  2. 2Match what you see, then jump to its fix

    1. 1curl-config: command not found, or dpkg lists libcurl4 but no libcurl4-openssl-devThe libcurl development package is not installedFix
    2. 2curl-config works but prints a version below the one in the package's SystemRequirementsThe installed libcurl is older than the package requiresFix

What does the error look like?

  • Configuration failed because libcurl was not found.
  • the R package install stops during configure and names libcurl

Cause 1 of 2

The libcurl development package is not installed

1Check

The runtime library only lets programs run. Building a package needs the headers and curl-config, which sit in the -dev package.

dpkg -s libcurl4-openssl-dev | grep Status

2Fix

The curl package lists libcurl4-openssl-dev as the Debian package to install. Install it and retry.

sudo apt update
sudo apt install libcurl4-openssl-dev

3Verify

The package builds, and the load test passes.

curl-config --version
Rscript -e 'install.packages("curl"); library(curl)'

Confirmed by cran.r-project.org

Did this fix it?

Cause 2 of 2

The installed libcurl is older than the package requires

1Check

The curl package states libcurl 7.73 or newer. An old distribution release can ship an older library, so the configure test fails even with the dev package present.

curl-config --version
lsb_release -ds

2Fix

Upgrade the system packages, or move to a distribution release that ships a newer libcurl. Pick an older curl package version from the CRAN archive only when you cannot upgrade.

sudo apt update
sudo apt upgrade

3Verify

curl-config reports a version at or above the requirement, and the install succeeds.

curl-config --version
Rscript -e 'install.packages("curl")'

Confirmed by cran.r-project.org

Did this fix it?

How do I stop it coming back?

  • Install system libraries for R packages from the package's SystemRequirements field before running install.packages.
  • Put the -dev packages you need in the Dockerfile or provisioning script, not in a hand-run fix.
  • Keep Ubuntu on a supported release so system libraries meet current CRAN requirements.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.