Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

pycurl

I wanted to run python file. But I could check this error when I ran it.

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

My system is Mac os 10.13.2 and I used python 2.7

like image 251
Thomas Avatar asked Dec 19 '17 14:12

Thomas


4 Answers

Looks like something went wrong with pycurl/openssl, try this:

pip uninstall pycurl
pip install --compile --install-option="--with-openssl" pycurl

if still fails, try this as well

brew reinstall openssl
like image 115
Eytan Avisror Avatar answered Nov 03 '22 00:11

Eytan Avisror


For m1 users, it works for me

brew install curl-openssl
pip uninstall pycurl

PYCURL_SSL_LIBRARY=openssl \
    LDFLAGS="-L$(brew --prefix openssl)/lib" \
    CPPFLAGS="-I$(brew --prefix openssl)/include" 

pip install --compile --install-option="--with-openssl" pycurl
like image 30
Jacob kshin Avatar answered Nov 03 '22 02:11

Jacob kshin


This was done by my fellow mac users.

# pycurl
pip uninstall pycurl
export CPPFLAGS=-I/usr/local/opt/openssl/include # may be needed
export LDFLAGS=-L/usr/local/opt/openssl/lib # may be needed
pip install --no-cache-dir --compile --ignore-installed --install-option="--with-openssl" pycurl

I got this same issue in windows which had a different fix(perhaps this might fit Mac too). In my requirements.txt I had pycurl-7.43.0.4 but on the windows dowloader page I could only find 7.44.1 which I installed (pip install .\pycurl-7.44.1-cp37-cp37m-win_amd64.whl). And then on starting my Django server python manage.py runserver I got the error in question. And the solution was to bring the pycurl back to it's expected version. pip install pycurl==7.43.0.5 and it replaced the version as given below. And the error was gone! enter image description here

like image 36
Blue Clouds Avatar answered Nov 03 '22 01:11

Blue Clouds


Reinstall the curl libraries

brew install curl --with-openssl

Install pycurl with correct environment and paths

export PYCURL_SSL_LIBRARY=openssl
pip uninstall pycurl 
pip install --no-cache-dir --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include"  pycurl
like image 36
Ruslan Avatar answered Nov 03 '22 02:11

Ruslan