"Could not run curl-config: [Errno 2] No such file or directory" when installing pycurl
Asked Answered
U

13

297

I'm trying to install pycurl via:

sudo pip install pycurl

It downloaded fine, but when when it runs setup.py I get the following traceback:

Downloading/unpacking pycurl
  Running setup.py egg_info for package pycurl
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip-build-root/pycurl/setup.py", line 563, in <module>
        ext = get_extension()
      File "/tmp/pip-build-root/pycurl/setup.py", line 368, in get_extension
        ext_config = ExtensionConfiguration()
      File "/tmp/pip-build-root/pycurl/setup.py", line 65, in __init__
        self.configure()
      File "/tmp/pip-build-root/pycurl/setup.py", line 100, in configure_unix
        raise ConfigurationError(msg)
    __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/tmp/pip-build-root/pycurl/setup.py", line 563, in <module>

    ext = get_extension()

  File "/tmp/pip-build-root/pycurl/setup.py", line 368, in get_extension

    ext_config = ExtensionConfiguration()

  File "/tmp/pip-build-root/pycurl/setup.py", line 65, in __init__

    self.configure()

  File "/tmp/pip-build-root/pycurl/setup.py", line 100, in configure_unix

    raise ConfigurationError(msg)

__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory

Any idea why this is happening and how to get around it

Unpremeditated answered 29/5, 2014 at 16:15 Comment(3)
are you using Ubuntu?Menhir
I'm on OSX with an ssh connection to a linux terminalUnpremeditated
where are you trying to install pycurl?Menhir
P
664

On Debian I needed the following packages to fix this

sudo apt install libcurl4-openssl-dev libssl-dev
Pradeep answered 5/6, 2014 at 3:14 Comment(8)
That fixed my issue on Ubuntu 12.04 (x64) and Python3.4 installedOutcome
Thanks, I needed the libssl-dev package in addition to yours. Strange how pip decouples from system package management but doesn't even give hints about which package it could be I'm missing on a very common linux distribution.Juvenescent
I need both libcurl4-openssl-dev and libssl-dev on Debian 9: sudo apt-get install libcurl4-openssl-dev libssl-devArum
Works on Ubuntu 18.04 LTS.Oceania
@JohnMcGehee, yep, works on Ubuntu 18.04.1 LTS on WSL too.Linnealinnean
be careful, libssl-dev is not compatible with npm rightnowManutius
any windows guy?Argil
Works on Pop!_OS 20.04 LTS / Ubuntu 20.04 LTSElielia
C
89

Similarly with yum package manager

yum install libcurl-devel

If you use dnf, use

dnf install libcurl-devel
Chopping answered 6/1, 2015 at 9:28 Comment(2)
In my case python-devel was missing as well, so the following solved the issue for me: yum install libcurl-devel python-develHort
Yup. Just apt install libcurl4-openssl-dev on an Ubuntu 20.04 system. (nowhere else mentioned for this OS distro)Salop
R
30

in my case this fixed the problem:

sudo apt-get install libssl-dev libcurl4-openssl-dev python-dev

as explained here

Rodrich answered 17/11, 2016 at 7:53 Comment(3)
thanks for the python-dev package! i had this error without it : src/pycurl.h:4:20: fatal error: Python.h: No such file or directoryCristiano
A better link would be https://mcmap.net/q/49583/-what-is-python-dev-package-used-for, which explains that these are libraries of C headers needed to build C Python extensions on Linux.Stockholder
Works for me in docker using ubuntu:focalSecretive
G
22

In Alpine linux you should do:

apk add curl-dev python3-dev libressl-dev
Gause answered 20/8, 2018 at 13:30 Comment(1)
apk add curl-dev was enough for me in docker python2.7-alpine image, thanks!Tillandsia
K
6

Same solution provided by @Michael Rice works for Ubuntu 18.04 as well

Ubuntu 18.04 LTS

sudo apt install libcurl4-openssl-dev libssl-dev

Al thought it is mentioned in comments of Michael's answer but thought highlight for easy of use.

Kim answered 22/3, 2021 at 12:25 Comment(0)
S
2

I encountered the same problem whilst trying to get Shinken 2.0.3 to fire up on Ubuntu. Eventually I did a full uninstall then reinstalled Shinken with pip -v. As it cleaned up, it mentioned:

Warning: missing python-pycurl lib, you MUST install it before launch the shinken daemons

Installed that with apt-get, and all the brokers fired up as expected :-)

Seismology answered 25/9, 2014 at 12:1 Comment(0)
C
2

That solved my problem on Ubuntu 14.04:

apt-get install libcurl4-gnutls-dev

Cardiomegaly answered 25/4, 2016 at 10:10 Comment(0)
G
2

If the following solution giving you an error while installing them,

sudo apt install libcurl4-openssl-dev libssl-dev

then try to update your Linux os first with:

sudo apt update
Goldiegoldilocks answered 21/7, 2022 at 0:5 Comment(0)
K
1

In addition to the answer of eldos I also needed gcc in CentOS 7:

yum install libcurl-devel gcc
Kab answered 27/3, 2020 at 18:39 Comment(1)
It was "yum install openssl-devel.x86_64 libcurl-devel.x86_64" for me on CentOS 8Doubt
B
0

On OpenSUSE:

zypper in libcurl-devel 
Bane answered 1/7, 2015 at 18:23 Comment(1)
zypper in libcurl-devel libopenssl-develDives
M
0

In my case i kept getting the same error message. I use fedora. I solved it by doing:

sudo dnf install pycurl

This installed eveything that I needed for it to work.

Maddocks answered 4/2, 2018 at 19:4 Comment(0)
J
0

I had this issue on Mac and it was related to the openssl package being an older version of what it was required by pycurl. pycurl can use other ssl libraries rather than openssl as per my understanding of it. Verify which ssl library you're using and update as it is very likely to fix the issue.

I fixed this by:

  • running brew upgrade
  • downloaded the latest pycurl-x.y.z.tar.gz from http://pycurl.io/
  • extracted the package above and change directory into it
  • ran python setup.py --with-openssl install as openssl is the library I have installed. If you're ssl library is either gnutls or nss then will have to use --with-gnutls or --with-nss accordingly. You'll be able to find more installation info in their github repository.
Jewelljewelle answered 5/6, 2019 at 14:38 Comment(0)
O
0

Be advised that if you're using nodejs there's (at the time of writing) a dependency on libssl 1.0.* - so installing an alternative SSL library will break your nodejs installation.

An alternative solution to installing a different SSL library is that posted in this answer here: https://mcmap.net/q/101923/-how-do-i-install-libcurl4-openssl-dev-together-with-libssl1-0-dev to instead install libcurl4-gnutls-dev

sudo apt install libcurl4-gnutls-dev
Oho answered 18/5, 2020 at 2:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.