Pyenv: ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Created on 17 Jul 2017  Â·  70Comments  Â·  Source: pyenv/pyenv

➜ ~ pyenv install 3.5.2
Installing Python-3.5.2...
patching file Lib/venv/scripts/posix/activate.fish
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

BUILD FAILED (Deepin 15.4 using python-build 20160602)

Inspect or clean up the working tree at /tmp/python-build.20170717074120.10900
Results logged to /tmp/python-build.20170717074120.10900.log

Last 10 log lines:
(cd /home/zonzely/.pyenv/versions/3.5.2/share/man/man1; ln -s python3.5.1 python3.1)
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

Most helpful comment

@dstyp, are you trying to install a version < 3.5.3? If so I don't know, else the above answers (CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v 3.5.3) should work.

All 70 comments

What os and version are you using ?

Also the fix is right there in the message you will need to go to https://github.com/pyenv/pyenv/wiki/Common-build-problems#error-the-python-ssl-extension-was-not-compiled-missing-the-openssl-lib then just copy and paste the script for your specific os

Debian GNU/Linux 9.1 (stretch)
pyenv 1.1.3
CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v 3.2.3

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (Debian 9.1 using python-build 20160602)

Inspect or clean up the working tree at /tmp/python-build.20170807132419.25380
Results logged to /tmp/python-build.20170807132419.25380.log

Last 10 log lines:
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/python3-config
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s python3.2-config python3-config)
rm -f /home/elderone/.pyenv/versions/3.2.3/lib/pkgconfig/python3.pc
(cd /home/elderone/.pyenv/versions/3.2.3/lib/pkgconfig; ln -s python-3.2.pc python3.pc)
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/idle3
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s idle3.2 idle3)
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/pydoc3
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s pydoc3.2 pydoc3)
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/2to3
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s 2to3-3.2 2to3)
building '_ssl' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/openssl -I/home/elderone/.pyenv/versions/3.2.3/include -fPIC -IInclude -I. -I./Include -I/home/elderone/.pyenv/versions/3.2.3/include
 -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/tmp/python-build.20170807132419.25380/Python-3.2.3 -c /tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c -o build/temp.linux-x86_64-3.2/tm
p/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.o
In file included from Include/Python.h:111:0,
                 from /tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:17:
Include/modsupport.h:27:1: warning: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Wformat=]
 PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
 ^~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c: In function ‘_create_tuple_for_X509_NAME’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:487:35: error: dereferencing pointer to incomplete type ‘X509_NAME_ENTRY {aka struct X509_name_entry_st}’
             if (rdn_level != entry->set) {
                                   ^~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c: In function ‘_get_peer_alt_names’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:607:16: error: dereferencing pointer to incomplete type ‘X509_EXTENSION {aka struct X509_extension_st}’
         p = ext->value->data;
                ^~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c: In function ‘PySSL_cipher’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:960:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     cipher_protocol = SSL_CIPHER_get_version(current);
                     ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c: In function ‘context_new’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:1458:9: warning: ‘TLSv1_method’ is deprecated [-Wdeprecated-declarations]
         ctx = SSL_CTX_new(TLSv1_method());
         ^~~
In file included from /usr/include/openssl/ct.h:13:0,
                 from /usr/include/openssl/ssl.h:61,
                 from /tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:93:
/usr/include/openssl/ssl.h:1612:1: note: declared here
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */
 ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:1465:27: warning: implicit declaration of function ‘SSLv2_method’ [-Wimplicit-function-declaration]
         ctx = SSL_CTX_new(SSLv2_method());
                           ^~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:1465:27: warning: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [-Wint-conversion]
In file included from /tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:93:0:
/usr/include/openssl/ssl.h:1321:17: note: expected ‘const SSL_METHOD * {aka const struct ssl_method_st *}’ but argument is of type ‘int’
 __owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
                 ^~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c: In function ‘PySSL_RAND_egd’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:1924:13: warning: implicit declaration of function ‘RAND_egd’ [-Wimplicit-function-declaration]
     bytes = RAND_egd(PyBytes_AsString(path));
             ^~~~~~~~
At top level:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:1974:13: warning: ‘_ssl_thread_locking_function’ defined but not used [-Wunused-function]
 static void _ssl_thread_locking_function
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_ssl.c:1970:22: warning: ‘_ssl_thread_id_function’ defined but not used [-Wunused-function]
 static unsigned long _ssl_thread_id_function (void) {
                      ^~~~~~~~~~~~~~~~~~~~~~~
building '_hashlib' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/openssl -I/home/elderone/.pyenv/versions/3.2.3/include -fPIC -IInclude -I. -I./Include -I/home/elderone/.pyenv/versions/3.2.3/include
 -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/tmp/python-build.20170807132419.25380/Python-3.2.3 -c /tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c -o build/temp.linux-x86_6
4-3.2/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.o
In file included from Include/Python.h:111:0,
                 from /tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:16:
Include/modsupport.h:27:1: warning: ‘_PyArg_ParseTuple_SizeT’ is an unrecognized format function type [-Wformat=]
 PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
 ^~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:62:26: error: field ‘ctx’ has incomplete type
     EVP_MD_CTX           ctx;   /* OpenSSL message digest context */
                          ^~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c: In function ‘EVP_dealloc’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:129:5: warning: implicit declaration of function ‘EVP_MD_CTX_cleanup’ [-Wimplicit-function-declaration]
     EVP_MD_CTX_cleanup(&self->ctx);
     ^~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c: In function ‘EVP_digest’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:165:16: error: storage size of ‘temp_ctx’ isn’t known
     EVP_MD_CTX temp_ctx;
                ^~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:165:16: warning: unused variable ‘temp_ctx’ [-Wunused-variable]
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c: In function ‘EVP_hexdigest’:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:185:16: error: storage size of ‘temp_ctx’ isn’t known
     EVP_MD_CTX temp_ctx;
                ^~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:185:16: warning: unused variable ‘temp_ctx’ [-Wunused-variable]
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c: At top level:
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:74:23: error: storage size of ‘CONST_new_md5_ctx’ isn’t known
     static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
                       ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:77:1: note: in expansion of macro ‘DEFINE_CONSTS_FOR_NEW’
 DEFINE_CONSTS_FOR_NEW(md5)
 ^~~~~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:74:23: error: storage size of ‘CONST_new_sha1_ctx’ isn’t known
     static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
                       ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:78:1: note: in expansion of macro ‘DEFINE_CONSTS_FOR_NEW’
 DEFINE_CONSTS_FOR_NEW(sha1)
 ^~~~~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:74:23: error: storage size of ‘CONST_new_sha224_ctx’ isn’t known
     static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
                       ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:80:1: note: in expansion of macro ‘DEFINE_CONSTS_FOR_NEW’
 DEFINE_CONSTS_FOR_NEW(sha224)
 ^~~~~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:74:23: error: storage size of ‘CONST_new_sha256_ctx’ isn’t known
     static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
                       ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:81:1: note: in expansion of macro ‘DEFINE_CONSTS_FOR_NEW’
 DEFINE_CONSTS_FOR_NEW(sha256)
 ^~~~~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:74:23: error: storage size of ‘CONST_new_sha384_ctx’ isn’t known
     static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
                       ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:82:1: note: in expansion of macro ‘DEFINE_CONSTS_FOR_NEW’
 DEFINE_CONSTS_FOR_NEW(sha384)
 ^~~~~~~~~~~~~~~~~~~~~
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:74:23: error: storage size of ‘CONST_new_sha512_ctx’ isn’t known
     static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
                       ^
/tmp/python-build.20170807132419.25380/Python-3.2.3/Modules/_hashopenssl.c:83:1: note: in expansion of macro ‘DEFINE_CONSTS_FOR_NEW’
 DEFINE_CONSTS_FOR_NEW(sha512)
 ^~~~~~~~~~~~~~~~~~~~~

Python build finished, but the necessary bits to build these modules were not found:
_dbm               _gdbm                              
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_hashlib           _ssl                               

CFLAGS="-I/usr/include/x86_64-linux-gnu/" LDFLAGS="-L/usr/lib/x86_64-linux-gnu/" PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.2.3
all the same...

Hi, look at https://github.com/pyenv/pyenv/issues/945, it's because Debian 9 uses OpenSSL 1.1.0 which support in CPython was added in 3.5.3 (more details in the issue above). Cheers

No solution to this yet? Trying to install...

@dstyp, are you trying to install a version < 3.5.3? If so I don't know, else the above answers (CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v 3.5.3) should work.

Worked! Thanks, completely overlooked your comment.

+1 having same trouble installing 3.5.2 on ubuntu

i'm having this on mac os high sierra even with setting CFLAGS and LDFLAGS correctly using brew --prefix

@makslevental Same here.

Is there a fix available for HighSierra ?

@uber1geek the problem turned out to be the openssl hadn't actually successfully installed (even though homebrew reported that it had). run brew uninstall openssl && brew install openssl && CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 3.6.2

I'm using macOS / OSX, but not homebrew, and I'm having this issue as well.

Is there a way to determine...

  1. whether I have openssl installed?

    I tried...

    $ which openssl
    /usr/bin/openssl
    
  2. the correct CFLAGS / LDFLAGS?

    I tried...

    $ CFLAGS="-I/usr/bin/openssl" LDFLAGS="-L/usr/lib" pyenv install 3.6.2
    Downloading readline-6.3.tar.gz...
    -> https://pyenv.github.io/pythons/56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43
    Installing readline-6.3...
    Installed readline-6.3 to /Users/colllin/.pyenv/versions/3.6.2
    
    Downloading Python-3.6.2.tar.xz...
    -> https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
    Installing Python-3.6.2...
    ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
    
    Please consult to the Wiki page to fix the problem.
    https://github.com/pyenv/pyenv/wiki/Common-build-problems
    
    
    BUILD FAILED (OS X 10.13 using python-build 20160602)
    
    Inspect or clean up the working tree at /var/folders/95/rsx7725n60vf4gjk0g9_1h_w0000gn/T/python-build.20170929153257.78102
    Results logged to /var/folders/95/rsx7725n60vf4gjk0g9_1h_w0000gn/T/python-build.20170929153257.78102.log
    
    Last 10 log lines:
                upgrade) ensurepip="--upgrade" ;; \
                install|*) ensurepip="" ;; \
            esac; \
             ./python.exe -E -m ensurepip \
                $ensurepip --root=/ ; \
        fi
    Collecting setuptools
    Collecting pip
    Installing collected packages: setuptools, pip
    Successfully installed pip-9.0.1 setuptools-28.8.0
    

@colllin you need the openssl headers which are in the include dir. i don't know where yours would be

I found a solution to my problem. (Fedora 26)
Uninstall:
$ dnf remove openssl-devel

Install:
$ dnf install compat-openssl10-devel

Mac OS X 10.13 (High Sierra) uses LibreSSL 2.2.7 but doesnt include the C headers necessary to compile the SSL extension for python. I know of no Apple-provided method to get them installed (via XCode or whatever else). To get this working without homebrew or any other shenanigans (assuming you have pyenv installed and working properly);

  • curl -O https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.2.7.tar.gz
  • tar xvf libressl-2.2.7.tar.gz
  • CFLAGS="-I./libressl-2.2.7/include" pyenv install 3.6.3 (or whatever other version)

(post edit)
I believe that pyenv is supposed to install openssl as necessary on Mac OS X in order to make the whole pyenv install process work properly. That is probably the real issue here, but the above steps appear to work around the problem for now.

I tried all suggestions above but it is not working on Hight Sierra 10.13.1 Beta (17B25c) and Xcode 9

@matheusabr I use @makslevental's method and it works
os version 10.13
installed python version 3.5.4

@crazyxrp It really works! Thanks

install openssl-devel.x86_64 or (openssl-dev...) should work.

openssl package only is not enough

Source: https://stackoverflow.com/questions/6171210/building-python-and-more-on-missing-modules

On Debian stretch, installing libssl1.0-dev (and removing libssl-dev) with apt worked fine. Python 2.7 installs fine now.

@laenderoliveira
woked for me

I found a solution to my problem. (Fedora 26)
Uninstall:
$ dnf remove openssl-devel
Install:
$ dnf install compat-openssl10-devel

In my case (Homebrew, OSX 10.13.1 - High Sierra) I had to specify both CFLAGS and CPPFLAGS:
LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" CFLAGS="-I/usr/local/opt/openssl/include" pyenv install 3.6.3

@Beenhakker
Your method worked for me in OSX 10.13.1 for installing 3.6.3. Thanks!

Not working for me to install 2.7.14 :(

Not working for me to install 2.7.6

@Beenhakker Thanks!
Your solution worked for me as well.

Had the same issue on Scientific Linux release 6.9 (Carbon). Following the instructions in the wiki didn't quite solve the problem. Solved it like @Beenhakker, except that I also added sqlite:

CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix sqlite)/include" \
CPPFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix sqlite)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix sqlite)/lib" \
pyenv install -v 3.6.4

I have mac os Sierra 10.13.4, openssl version LibreSSL 2.2.7, python 3.6.5 and 2.7.10, but I can not install everything via pip(3) install ... because "There was a problem confirming the ssl certificate: [SSL: UNKNOWN_PROTOCOL] unknown protocol". Do you have any solutions for this?

At this point I've decided pyenv isn't worth the hassle. Activating a virtual environment using %source bin/activate is not a struggle, but getting pyenv to work properly is.

@justinjdickow I highly recommend checking out pipenv If you haven’t already. Besides managing your python environments, it also produces and maintains a lock file.

anyone came here trying to get 3.7.0 working ubuntu trusty (14.04), it won't work (easily with ubuntu provided packages) since 3.7.0 requires openssl 1.0.2 and trusty only has 1.0.1 : https://github.com/travis-ci/travis-ci/issues/9069

Thanks @sabujp - this was exactly my issue

I had trouble installing 2.7 in ubuntu 18.04. Here is what worked

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"

$  pyenv install 2.7.8
Downloading Python-2.7.8.tar.xz...
-> https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
Installing Python-2.7.8...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
patching file ./Modules/_ssl.c
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems
BUILD FAILED (Ubuntu 18.04 using python-build 1.2.3-43-g35f7ef8)
Inspect or clean up the working tree at /tmp/python-build.20180723091911.21509
Results logged to /tmp/python-build.20180723091911.21509.log

$ sudo apt install -y libssl1.0-dev
The following packages will be REMOVED:
  libssl-dev
The following NEW packages will be installed:
  libssl1.0-dev
0 upgraded, 1 newly installed, 1 to remove and 2 not upgraded.
Need to get 1,364 kB of archives.
After this operation, 380 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.0-dev amd64 1.0.2n-1ubuntu5.1 [1,364 kB]
Fetched 1,364 kB in 1s (2,098 kB/s)     
(Reading database ... 188780 files and directories currently installed.)
Removing libssl-dev:amd64 (1.1.0g-2ubuntu4.1) ...
Selecting previously unselected package libssl1.0-dev:amd64.
(Reading database ... 188695 files and directories currently installed.)
Preparing to unpack .../libssl1.0-dev_1.0.2n-1ubuntu5.1_amd64.deb ...
Unpacking libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.1) ...
Setting up libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.1) ...

$ pyenv install 2.7.8
Downloading Python-2.7.8.tar.xz...
-> https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
Installing Python-2.7.8...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
patching file ./Modules/_ssl.c
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.8 to /home/saurajeet/.pyenv/versions/2.7.8

The same for me on Ubuntu 18.04. Installing Python 2.7.5 only worked after I removed libssl-dev and installed libssl1.0-dev afterwards. Then a simple pyenv install 2.7.5 worked as expected.

I can confirm this for Raspbian Stretch and Python 3.6.3. Didn't work without installing libssl1.0-dev but it's fine now.

Thank @Beenhakker ...
You save my day

MacOS 10.13.6
Install python 2.7.10

worked for me, thank you very much @Beenhakker

Mac OS 10.13.1
python version 3.6.3

Mac OS 10.14.4
python version 3.7.2
I had to collectively try all of the above. What worked for me is:

In your .bash_profile OR .zshrc
First:

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

Second: (make sure you have brew openssl installed)
brew install python
brew install pyenv

Lastly:

pyenv install -v 3.7.2

Good luck!

install openssl-devel.x86_64 or (openssl-dev...) should work.

openssl package only is not enough

Source: https://stackoverflow.com/questions/6171210/building-python-and-more-on-missing-modules

This saved me as it worked for me after hours of struggle. I tried installing 'openssl-devel.x86_64', didn't work. I tried 'openssl1.0-dev' and it worked for me. Now I have python 2.7.16 installed

The same for me on Ubuntu 18.04. Installing Python 2.7.5 only worked after I removed libssl-dev and installed libssl1.0-dev afterwards. Then a simple pyenv install 2.7.5 worked as expected.

This made my day!! Tx

On linux install libssl-dev first and them install python

sudo apt install libssl-dev
asdf install python <yourVersionHere>

I had trouble installing 2.7 in ubuntu 18.04. Here is what worked

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"

$  pyenv install 2.7.8
Downloading Python-2.7.8.tar.xz...
-> https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
Installing Python-2.7.8...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
patching file ./Modules/_ssl.c
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems
BUILD FAILED (Ubuntu 18.04 using python-build 1.2.3-43-g35f7ef8)
Inspect or clean up the working tree at /tmp/python-build.20180723091911.21509
Results logged to /tmp/python-build.20180723091911.21509.log

$ sudo apt install -y libssl1.0-dev
The following packages will be REMOVED:
  libssl-dev
The following NEW packages will be installed:
  libssl1.0-dev
0 upgraded, 1 newly installed, 1 to remove and 2 not upgraded.
Need to get 1,364 kB of archives.
After this operation, 380 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.0-dev amd64 1.0.2n-1ubuntu5.1 [1,364 kB]
Fetched 1,364 kB in 1s (2,098 kB/s)     
(Reading database ... 188780 files and directories currently installed.)
Removing libssl-dev:amd64 (1.1.0g-2ubuntu4.1) ...
Selecting previously unselected package libssl1.0-dev:amd64.
(Reading database ... 188695 files and directories currently installed.)
Preparing to unpack .../libssl1.0-dev_1.0.2n-1ubuntu5.1_amd64.deb ...
Unpacking libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.1) ...
Setting up libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.1) ...

$ pyenv install 2.7.8
Downloading Python-2.7.8.tar.xz...
-> https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
Installing Python-2.7.8...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
patching file ./Modules/_ssl.c
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.8 to /home/saurajeet/.pyenv/versions/2.7.8

Worked for me on

$ lsb_release -a
No LSB modules are available.
Distributor ID: elementary
Description:    elementary OS 5.0 Juno
Release:    5.0
Codename:   juno

Thanks!

Had the same issue when installing python 2.7.10 running OS X 15.1 (Catalina). The problem is that the openssl version provided by brew ([email protected]) is not compatible for compiling python 2.7.10. Support for OpenSSL 1.1.x, was only added in Python 2.7.13, 3.5.3 and 3.6.0.

Since it wasn't possible to downgrade to [email protected] using brew I had to remove the openssl version provided by brew and after that pyenv automatically downloaded openssl 1.0.2 to compile python.

EDIT: This solution may cause some issues when using libraries depending on openssl (i.e hashlib)
I found the way to install openssl 1.0 using brew:
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

For MacOSx Simply reinstall openssl:brew reinstall [email protected]

Support for OpenSSL 1.1.x, was only added in Python 2.7.13, 3.5.3 and 3.6.0

So to install Python 3.5.2 on Mac I had to do the following:

brew uninstall --ignore-dependencies [email protected]
pyenv install 3.5.2

@tdigangi and @asmaier 's solution works for me on Mac when installing 2.7.4.

On MacOs 10.15.2 there seems to be literally nothing I can do to get it working.

Have tried re-installing openssl, tried setting compiler flags, tried complete nuclear uninstall python using brew and not brew.

CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" asdf install python 3.5.2
python-build 3.5.2 /Users/adamlancaster/.asdf/installs/python/3.5.2
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.5.2.tar.xz...
-> https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
Installing Python-3.5.2...
patching file Lib/venv/scripts/posix/activate.fish
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.15.2 using python-build 1.2.16-2-g36fc10fb)

Inspect or clean up the working tree at /var/folders/gm/84m52gh16sx9g7l_gln_w77r0000gn/T/python-build.20200113113216.50262
Results logged to /var/folders/gm/84m52gh16sx9g7l_gln_w77r0000gn/T/python-build.20200113113216.50262.log

Last 10 log lines:
(cd /Users/adamlancaster/.asdf/installs/python/3.5.2/share/man/man1; ln -s python3.5.1 python3.1)
if test "xupgrade" != "xno"  ; then \
        case upgrade in \
            upgrade) ensurepip="--upgrade" ;; \
            install|*) ensurepip="" ;; \
        esac; \
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

I believe the issue here is that python <= 3.5.2 needs openssl 1.0. Homebrew removed openssl 1.0 recently (https://github.com/Homebrew/homebrew-core/issues/46454). I suspect installing anything v3.5.3 or greater will work, but anything older than that won't compile with openssl 1.1.

@robbydyer @Adzz Did you find a solution for MacOS Catalina (10.15)?

@afrancht What worked for me was: brew uninstall --ignore-dependencies openssl then installing python. In my case I was using asdf, but I think python will install its own version of openssl if you do that.

@afrancht What worked for me was: brew uninstall --ignore-dependencies openssl then installing python. In my case I was using asdf, but I think python will install its own version of openssl if you do that.

This works, it seems it downloads the version of SSL that it needs by itself. Thanks.

Debian GNU/Linux 9.1 (stretch)
pyenv 1.1.3
CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v 3.2.3

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (Debian 9.1 using python-build 20160602)

Inspect or clean up the working tree at /tmp/python-build.20170807132419.25380
Results logged to /tmp/python-build.20170807132419.25380.log

Last 10 log lines:
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/python3-config
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s python3.2-config python3-config)
rm -f /home/elderone/.pyenv/versions/3.2.3/lib/pkgconfig/python3.pc
(cd /home/elderone/.pyenv/versions/3.2.3/lib/pkgconfig; ln -s python-3.2.pc python3.pc)
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/idle3
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s idle3.2 idle3)
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/pydoc3
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s pydoc3.2 pydoc3)
rm -f /home/elderone/.pyenv/versions/3.2.3/bin/2to3
(cd /home/elderone/.pyenv/versions/3.2.3/bin; ln -s 2to3-3.2 2to3)

It is easier to let the system choose the proper directories for openssl under debian/ubuntu. This worked for me after install all Prerequisites:

CFLAGS=$(pkg-config openssl --cflags-only-I) LDFLAGS=$(pkg-config openssl --libs-only-L) pyenv install -v 3.6.1

I follwed the directions from Pyenv Wiki meticulously several times. Still, THIS DOES NOT WORK. Support, ideas, or condolences are accepted.

I reset my ENV with

% PATH=$(getconf PATH)

THen clean up my ~/.zshrc file. Currently, Looks like this:

PATH="~/.pyenv/shims:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH

export PYENV_ROOT="$HOME/.pyenv"
export TMPDIR="$HOME/src"


if type brew &>/dev/null; then
  FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH

  autoload -Uz compinit
  compinit
fi

eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Then reset my shell with

source ~/.zshrc

Next I installed pyenv doctor with

$ git clone git://github.com/pyenv/pyenv-doctor.git $(pyenv root)/plugins/pyenv-doctor

and ran with varying results

$ pyenv doctor ....

Cloning into ~/.pyenv/plugins/pyenv-doctor/bin/.....
Installing python-pyenv-doctor...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 10.15.3 using python-build 20180424)

Inspect or clean up the working tree at ~/src/python-build.20200321133544.93124
Results logged to /Users/mark/src/python-build.20200321133544.93124.log

Deleted temp builds from ~/src (That I specified in ~/.zshrc) and re-ran

$ pyenv doctor ...

BUILD FAILED (OS X 10.15.3 using python-build 20180424)

Inspect or clean up the working tree at /Users/mark/src/python-build.20200321133803.94231
Results logged to /Users/mark/src/python-build.20200321133803.94231.log

Last 10 log lines:
checking readline/readline.h, usability... no
checking readline/readline.h, presence... no
checking for readline/readline.h,... no
checking readline/rlconf.h usability... yes
checking readline/rlconf.h presence... yes
checking for readline/rlconf.h... yes
checking for SSL_library_init in -lssl... no
configure: WARNING: OpenSSL <1.1 not installed. Checking v1.1 or beyond...
checking for OPENSSL_init_ssl in -lssl... no
configure: error: OpenSSL is not installed.

Next I added the flags as listed in the pyenv wiki

$ CFLAGS="-I$(brew --prefix [email protected])/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" CPPFLAGS="-I$(brew --prefix zlib)/include -I$(brew --prefix [email protected])/include" LDFLAGS="-L$(brew --prefix [email protected])/lib -L$(brew --prefix readline)/lib" pyenv doctor

...

Installed python-pyenv-doctor to ~/src/pyenv-doctor.20200321134239.97399/prefix

Congratulations! You are ready to build pythons!

Great! It pyenv doctor worked! Now I uses the same flags to install python 2.7.7

$ CFLAGS="-I$(brew --prefix [email protected])/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" CPPFLAGS="-I$(brew --prefix zlib)/include -I$(brew --prefix [email protected])/include" LDFLAGS="-L$(brew --prefix [email protected])/lib -L$(brew --prefix readline)/lib" pyenv install -v 2.7.7

...

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.15.3 using python-build 20180424)

Inspect or clean up the working tree at ~/src/python-build.20200321134415.99281
Results logged to ~/src/python-build.20200321134415.99281.log

EPIC FAIL! Inpsecting the log I found some notables:

ld: framework not found QuickTime
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             bsddb185           dl              
imageop            linuxaudiodev      ossaudiodev     
spwd               sunaudiodev                        
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_hashlib           _Qt                _ssl 

Please Help, any expert advice would be much obliged!!

I have the same issue

@dstyp, are you trying to install a version < 3.5.3? If so I don't know, else the above answers (CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v 3.5.3) should work.

This is still valid!
Python: 3.8.0
OS: OSX Catalina
Using 3.8.0, and encountered the below when I tried to pip install ...

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/

I found that when I did python on Terminal, I could not import ssl:

import ssl
>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/james/.pyenv/versions/3.8.0/lib/python3.8/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: dlopen(/Users/james/.pyenv/versions/3.8.0/lib/python3.8/lib-dynload/_ssl.cpython-38-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/james/.pyenv/versions/3.8.0/lib/python3.8/lib-dynload/_ssl.cpython-38-darwin.so
  Reason: image not found

By doing CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v 3.8.0, I now can do pip install

Removing ssl from brew via brew uninstall --ignore-dependencies [email protected]
and pyenv install -v 3.4.1 worked for me

Removing ssl from brew via brew uninstall --ignore-dependencies [email protected]
and pyenv install -v 3.4.1 worked for me

Also worked for me. I did have other libraries which depend on 1.1 so I just reinstalled it after getting python installed.

Is this something which could be added to pyenv to ignore openssl 1.1 for version of python which don't support it?

my system is macOs 10.14.6
i tried :
$ pyenv install 2.7.10

bu get an error :

python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-2.7.10.tar.xz...
-> https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
Installing Python-2.7.10...
patching file ./Lib/site.py
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

### BUILD FAILED (OS X 10.14.6 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/0g/gmp473xj3wg9v9cmw2ngl0l80000gn/T/python-build.20200428151934.51752
Results logged to /var/folders/0g/gmp473xj3wg9v9cmw2ngl0l80000gn/T/python-build.20200428151934.51752.log

Last 10 log lines:
rm -f /Users/ahmadsamir/.pyenv/versions/2.7.10/share/man/man1/python.1
(cd /Users/ahmadsamir/.pyenv/versions/2.7.10/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno" ; then \
case no in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
./python.exe -E -m ensurepip \
$ensurepip --root=/ ; \
fi

To summarize the "fix" for folks on Mac OSX needing any version of python < 3.5.1.

Steps are:

brew uninstall --force --ignore-dependencies [email protected] && \
pyenv install -v 2.7.16 && \
brew install [email protected]

I found a much nicer way (could have been on this thread or elsewhere) which means you don't need to uninstall openssl. There is an environment variable you can use to specify which open ssl to use. I was able to use the following to install 3.4.4. Hope that helps someone.

[email protected] pyenv install 3.4.4

I found a much nicer way (could have been on this thread or elsewhere) which means you don't need to uninstall openssl. There is an environment variable you can use to specify which open ssl to use. I was able to use the following to install 3.4.4. Hope that helps someone.

[email protected] pyenv install 3.4.4

+1 for this 🎉 @asmith-r7

Uninstall and reinstalling openssl worked for 3.5.2 but not 3.4.4.

The closest I've got is https://github.com/pyenv/pyenv/issues/950#issuecomment-624131159

My issue is that that pip never gets installed. A python without pip is not that useful if you need dependencies.

The tail end of my output indicates an permissions issue with an directory /lib which seems like an odd directory I'm used to something more like /usr/lib

if test "xno" != "xno"  ; then \
                case no in \
                        upgrade) ensurepip="--upgrade" ;; \
                        install|*) ensurepip="" ;; \
                esac; \
                 ./python.exe -E -m ensurepip \
                        $ensurepip --root=/ ; \
        fi
Installing pip from https://bootstrap.pypa.io/get-pip.py...
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
  Using cached pip-20.1-py2.py3-none-any.whl (1.5 MB)
Collecting setuptools
  Using cached setuptools-44.1.0-py2.py3-none-any.whl (583 kB)
Collecting wheel
  Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, setuptools, wheel
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/lib'

I'm on osx catalina 10.15.4

brew --version
Homebrew 2.2.16-69-g9fcaa46
Homebrew/homebrew-core (git revision ed660b; last commit 2020-05-16)
Homebrew/homebrew-cask (git revision cc821; last commit 2020-05-16)

To install python 2.6.x. in MacOS Catalina I mixed two posted solutions in the thread. What follows is the result that worked for me:

brew install --force https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
CFLAGS="-I$/usr/local/Cellar/openssl/1.0.2t/include"
LDFLAGS="-L$/usr/local/Cellar/openssl/1.0.2t/lib"

brew uninstall --force --ignore-dependencies [email protected]
pyenv install -v 2.6.6
/Users/<user>/.pyenv/versions/2.6.6/bin/python <-- Now is installed and works!
brew install openssl

I hope it works for you. 💪

Here is how I build a specific version of Python3 on macOS 10.14.6 Mojave with support for enchant (spell check) and Sphinx with PDF generation.

#!/bin/sh
set -e

# Install XCode command-line tools
xcode-select --install
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

# Install zlib
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

# Install Brew (comment out if you already have it)
mkdir brew
cd brew
curl -O https://raw.githubusercontent.com/Homebrew/install/master/install
ruby install
rm install
cd ..
rmdir brew

# Upgrade brew
brew update

# Needed for Imagemagick
sudo mkdir /usr/local/Frameworks
sudo chown $(whoami):admin /usr/local/Frameworks

# Install Imagemagick and TeX for Sphinx PDF generation
# Install enchant for spell check linting
# Install pyenv
brew cask install mactex
brew cask upgrade mactex
brew install homebrew/core/make pyenv imagemagick enchant
brew upgrade homebrew/core/make pyenv imagemagick enchant

# Install python3 using pyenv
export PYVERSION=3.7.7
[email protected] SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 pyenv install $PYVERSION
pyenv rehash

Support for OpenSSL 1.1.x, was only added in Python 2.7.13, 3.5.3 and 3.6.0.

Found this and finally give up installing Python 2.7.11 and switch to Python 2.7.13 because I have OpenSSL 1.1.1g installed.

But pyenv install 2.7.13 still does not work, I had to use wget -P $(pyenv root)/cache https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz before pyenv install 2.7.13

Finally it works. By the way, I'm using Cent OS 7 and the error is ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

make: *** [install] Error 1

BUILD FAILED (OS X 10.15.6 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/8x/0pb59h191rx0z98hv748n5b93m2scn/T/python-build.20200903142101.80200
Results logged to /var/folders/8x/0pb59h191rx0z98hv748n5b93m2scn/T/python-build.20200903142101.80200.log

Last 10 log lines:
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi
Looking in links: /var/folders/8x/0pb59h191rx0z98hv748n5b93m2scn/T/tmp5emg3txn
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/lib'

make: *** [install] Error 1

I can't get this to work on MacOS 10.15.6 either. This is the command I used to install 3.7.5:

CFLAGS="-I/usr/local/opt/[email protected]/include" LDFLAGS="-L/usr/local/opt/[email protected]/lib" pyenv install -v 3.7.5

Same problem... Ubuntu 14.04 and Python 3.8.6

still trying to find the right incantation to make it work

apt-get install libssl-dev did not help

issue seems to be around OpenSSL / libssl-dev version

under Ubuntu 14.04 after doing apt-get update && apt-get install libssl-dev I see:

Step 3/18 : RUN openssl version -a
 ---> Running in 6c1258406a98
OpenSSL 1.0.1f 6 Jan 2014

and the Python 3.8.6 install fails with the error from this issue

Upgrading the container to Ubuntu 18 gives:

Step 3/18 : RUN openssl version -a
 ---> Running in dd26ca4d216f
OpenSSL 1.1.1  11 Sep 2018

and the Python install succeeds

I found a much nicer way (could have been on this thread or elsewhere) which means you don't need to uninstall openssl. There is an environment variable you can use to specify which open ssl to use. I was able to use the following to install 3.4.4. Hope that helps someone.

[email protected] pyenv install 3.4.4

Very helpful! I was able to use this method to install 2.7.18 on macOS 10.15.7:

[email protected] pyenv install  2.7.18
Was this page helpful?
0 / 5 - 0 ratings

Related issues

legnaleurc picture legnaleurc  Â·  29Comments

eligreg picture eligreg  Â·  23Comments

lanox picture lanox  Â·  31Comments

lysnikolaou picture lysnikolaou  Â·  20Comments

shishirsharma picture shishirsharma  Â·  35Comments