I have an ec2 instance in AWS running Python3.6 (Amazon Linux/2.8.3) where I need to install pycurl with NSS ssl backend.
First I tried it by adding pycurl==7.43.0 --global-option="--with-nss"
to my requirement.txt
file but I was getting errors installation errors. So I ended up doing it by adding a .config
file in .ebextensions
(that runs during deployment):
container_commands:
09_pycurl_reinstall:
# the upgrade option is because it will run after PIP installs the requirements.txt file.
# and it needs to be done with the virtual-env activated
command: 'source /opt/python/run/venv/bin/activate && PYCURL_SSL_LIBRARY=nss pip3 install pycurl --global-option="--with-nss" --upgrade --no-cache-dir --compile --ignore-installed'
Pycurl seems to be correctly installed, but the celery worker is not running. The celery worker logs show:
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
If I ssh connect to the instance and run python 3.6 -c 'import pycurl'
I get a more detailed error:
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (nss)
So I guess that my problem is that I had previously installed libcurl with openSSL instead of NSS, and hence the mismatch between libcurl and pycurl.
According to another stackoverflow question, for libcurl to be installed with NSS backend I should have installed it with:
sudo apt libcurl4-nss-dev
But since the server is running Amazon Linux I can't use the apt
command. So I did instead:
yum install libcurl-devel
And I guess this is the problem: this installs libcurl with OpenSSL support when I need it with NSS support.
How can I install libcurl with NSS in Amazon Linux?? (I need NSS because I'm running a Django app with celery using SQS as the broker, and SQS requires NSS).
Thank you very much!