Search code examples
pythonpiplibcurlpycurlpipenv

importing pycurl with libcurl4 raises ImportError


I am using Ubuntu 18.04. If I install libcurl4 (instead of libcurl3), when I import pycurl installed with pipenv I get

>>> import pycurl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /home/pietro/envs/try_fabric-kcbGLH3z/lib/python3.6/site-packages/pycurl.cpython-36m-x86_64-linux-gnu.so)

Note that this error is raised only when I use a pycurl installed with pipenv or pip. If I use instead pycurl installed through apt on system python there are any errors...

What can I do to avoid this impasse?


Solution

  • I assume you upgraded your operating system recently.

    pip stores a cache of built wheels in your home directory, when upgrading your os it is a good idea to clear this cache as the binaries may now link against incompatible system libraries

    You can do this by rm -rf ~/.cache/pip and then recreate your environment