Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid value "libressl" for PYCURL_SSL_LIBRARY #530

Closed
roerd opened this issue Jun 6, 2018 · 3 comments · Fixed by #580
Closed

Invalid value "libressl" for PYCURL_SSL_LIBRARY #530

roerd opened this issue Jun 6, 2018 · 3 comments · Fixed by #580

Comments

@roerd
Copy link

roerd commented Jun 6, 2018

What did you try to do?

Install pycurl with pip on Mac OS High Sierra (10.13.4).

What happened?

Installation failed with error message

Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.

Therefore, I checked curl --version and got this output:

curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy

Therefore, I set PYCURL_SSL_LIBRARY to libressl and tried to install pycurl again. This time, it failed with the error message

Invalid value "libressl" for PYCURL_SSL_LIBRARY

(which I also used for the title of this issue).

What did you expect to happen?

Successful installation of pycurl using the Mac OS system-provided version of curl which is compiled against LibreSSL.

What is the PycURL version?

Current version from PyPI, i.e. 7.43.0.2.

What is your Python version?

2.7.10

Other versions

pip 10.0.1

@p
Copy link
Member

p commented Jun 7, 2018

The flag for LibreSSL is --with-openssl, I will add that to documentation.

@roerd
Copy link
Author

roerd commented Jun 7, 2018

Thanks, installing with PYCURL_SSL_LIBRARY=openssl works, but only if I point pip also to an include directory for openssl header files, because Apple doesn't seem to ship the one for the version of LibreSSL they're using with macOS High Sierra. So I had to install pycurl with

pip install pycurl --global-option="build_ext" --global-option="-I/usr/local/opt/openssl/include"

(I'm not completely sure, but I suppose that include directory was installed by Homebrew.)

leohemsted added a commit to alphagov/notifications-api that referenced this issue Oct 3, 2018
you need to `pip install celery[sqs]` to get the additional
dependencies that celery needs to use SQS queues - there are two libs -
boto3 and pycurl.

pycurl is a bunch of python handles around curl, so needs to be
installed from source so it can link to your curl/ssl libs. On paas and
in docker this works fine (needed to add `libcurl4-openssl-dev` to the
docker container), but on macos it can't find openssl. We need to pass
a couple of flags in:

* set the environment variable PYCURL_SSL_LIBRARY=openssl
* pass in the global options `build_ext` and `-I{openssl_headers_path}`.

As shown here:
pycurl/pycurl#530 (comment)

Env var is no biggie, but using any install-option flags disables
wheels for the whole pip install run. (See
pypa/pip#2677 and
pypa/pip#4118 for more context on the
install-options flags). A whole bunch of our dependencies don't
install nicely from source (but do from wheel), so this commit installs
pycurl separately as an initial step, with the requisite flags, and
then installs the rest of the requirements as before.

I've updated the makefile and bootstrap.sh files to reflect this, but
if you run `pip install -r requirements.txt` from scratch you will run
into issues.
leohemsted added a commit to alphagov/notifications-api that referenced this issue Oct 3, 2018
you need to `pip install celery[sqs]` to get the additional
dependencies that celery needs to use SQS queues - there are two libs -
boto3 and pycurl.

pycurl is a bunch of python handles around curl, so needs to be
installed from source so it can link to your curl/ssl libs. On paas and
in docker this works fine (needed to add `libcurl4-openssl-dev` to the
docker container), but on macos it can't find openssl. We need to pass
a couple of flags in:

* set the environment variable PYCURL_SSL_LIBRARY=openssl
* pass in the global options `build_ext` and `-I{openssl_headers_path}`.

As shown here:
pycurl/pycurl#530 (comment)

Env var is no biggie, but using any install-option flags disables
wheels for the whole pip install run. (See
pypa/pip#2677 and
pypa/pip#4118 for more context on the
install-options flags). A whole bunch of our dependencies don't
install nicely from source (but do from wheel), so this commit installs
pycurl separately as an initial step, with the requisite flags, and
then installs the rest of the requirements as before.

I've updated the makefile and bootstrap.sh files to reflect this, but
if you run `pip install -r requirements.txt` from scratch you will run
into issues.
ur pushed a commit to p-push/pycurl that referenced this issue Jun 30, 2019
@p p closed this as completed in #580 Jun 30, 2019
@repollo
Copy link

repollo commented May 12, 2022

In case anyone else needs it:

Instructions per rtsp_curl:

PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" pip install --no-cache-dir pycurl

If using openssl installed via homebrew make sure LDFLAGS(lib folder) and CPPFLAGS(ssl.h) folder is pointing to the correct locations, for me it was:

PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/homebrew/homebrew/Cellar/[email protected]/1.1.1n/lib" CPPFLAGS="-I/usr/local/homebrew/homebrew/Cellar/[email protected]/1.1.1n/include" pip install --no-cache-dir pycurl

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants