Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? (installing python 2.7 on ubuntu 18.04)

I keep getting this error when trying to install any version of Python 2.7.x using asdf version manager on Ubuntu 18.04. I have googled but there's a lot of answers that don't work. How can I solve it?

like image 713
juliangonzalez Avatar asked Oct 18 '18 11:10

juliangonzalez


1 Answers

At the end of the error there's a link to this page

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

When you open that page it has first some solutions for Other *nix systems but for ubuntu you need to look deeper:

On Debian stretch (and Ubuntu bionic), libssl-dev is OpenSSL 1.1.x, but support for that was only added in Python 2.7.13, 3.5.3 and 3.6.0. To install earlier versions, you need to replace libssl-dev with libssl1.0-dev. This is being tracked in https://github.com/pyenv/pyenv/issues/945.

So if you don't need a specific version of 2.7 you can go ahead and install 2.7.13 and the error will not appear. Or you can replace the library when installing dependencies.

sudo apt-get install -y make build-essential libssl1.0-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
like image 97
juliangonzalez Avatar answered Sep 21 '22 18:09

juliangonzalez