Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL backend error when using OpenSSL

I was trying to install pycurl in a virtualenv using pip and I got this error

ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

I read some documentation saying that "To fix this, you need to tell setup.py what SSL backend is used" (source) although I am not sure how to do this since I installed pycurl using pip.

How can I specify the SSL backend when installing pycurl with pip?

Thanks

like image 729
helloworld2013 Avatar asked Jan 13 '14 16:01

helloworld2013


4 Answers

for most people

After reading their INSTALLATION file, I was able to solve my problem by setting an environment variable and did a reinstall

# remove existing `pycurl` installation 
pip uninstall pycurl

# export variable with your link-time ssl backend (which is openssl above)
export PYCURL_SSL_LIBRARY=openssl

# then, re-install `pycurl` with **no cache**
pip install pycurl --no-cache-dir

There could be other solution out there but this works perfectly for me on a virtualenv and pip installation.

Some people have a different error message complaining about nss instead of openssl

ImportError: pycurl: libcurl link-time ssl backend (nss)

(the key part is nss) so you have to do something different for this error message:

pip uninstall pycurl
pip install --no-cache-dir --compile --compile-options="--with-nss" pycurl
like image 164
helloworld2013 Avatar answered Oct 21 '22 08:10

helloworld2013


helloworld2013's answer is correct, but the key is matching the SSL library that pycurl is expecting. The error will be something like:

pycurl: libcurl link-time ssl backend (<library>) is different from compile-time ssl backend (<library> or "none/other")

To fix it, you have to use the library pycurl is expecting. In my case, my error was "pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)", so my fix was:

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
pip install pycurl
like image 37
DrStrangepork Avatar answered Oct 21 '22 07:10

DrStrangepork


With macOS 10.13, a brew-installed openSSL, and virtualenv, I was successful with:

# cd to your virtualenv, then…
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
pip install pycurl --compile --no-cache-dir
like image 58
Michael Wilson Avatar answered Oct 21 '22 09:10

Michael Wilson


With pip 7.1 you can put the following in your requirements file:

pycurl==7.19.5.1 --global-option="--with-nss"

Simply replace nss with the relevant ssl backend library.

like image 25
maharg101 Avatar answered Oct 21 '22 07:10

maharg101