pyenv: BUILD FAILED (Ubuntu 15.04 using python-build 20160509)

Each Answer to this Q is separated by one/two green lines.

I have already installed the pyenv on my system, and the command pyenv install --list goes well. But when I download some Python versions using pyenv install 2.7.11, it turns out as follows:

Downloading Python-2.7.11.tgz...
-> https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
error: failed to download Python-2.7.11.tar.gz

BUILD FAILED (Ubuntu 15.04 using python-build 20160509)

I didn’t find any similar problem on the official Common build problems.

Is it that pyenv didn’t catch the new Ubuntu update?

The command pyenv install -v 2.7.11 gave me a similar error.

Installing the pyenv requirements solved my issue :

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev

(See https://github.com/pyenv/pyenv/wiki/Common-build-problems)

Then :

pyenv install 2.7.11

To install python by using pyenv, the command pyenv install -v 2.7.11 could show more message than pyenv install 2.7.11. So it will be easy for me to locate the error. This time I got

curl: (77) error setting certificate verify locations: CAfile:
/etc/pki/tls/certs/ca-bundle.crt
CApath: none

This problem has already been solved in curl: (77) error

# sudo apt-get install ca-certificates

The issue was that curl expected the certificate to be at the path /etc/pki/tls/certs/ca-bundle.crt but could not find it because it was at the path /etc/ssl/certs/ca-certificates.crt.

Copying my certificate to the expected destination by running

sudo cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt

worked for me. You will need to create folders for the target destination if they do not exist by running

sudo mkdir -p /etc/pki/tls/certs

If needed, modify the above command to make the destination file name match the path expected by curl, i.e. replace /etc/pki/tls/certs/ca-bundle.crt with the path following “CAfile:” in your error message.

The default installing curl don’t support https protocol. You can check with “curl –version”. you can find http but no https.

So you need to reinstall curl refering how to install curl and libcurl.

./configure --prefix=$YOUR_DIR --with-ssl
make
make install

or find where you install the ssl for example /opt/OpenSSL

./configure --with-ssl=/opt/OpenSSL

make
make install

how to install curl and libcurl

I was facing a similar issue. I was using the fedora 29 and trying to install the python 2.7.5. Below was the error output.

BUILD FAILED (Fedora 29 using python-build 1.2.9-35-gb6109093)
Inspect or clean up the working tree at /tmp/python-build.20190405111845.17497
./python -E -S -m sysconfig –generate-posix-vars
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
make: *** [Makefile:464: pybuilddir.txt] Segmentation fault (core dumped)

I was searching for a solution then stumbled upon this thread.. which says:–

issue was a longstanding in Python < 2.7.15, and recently triggered with recent compiler. They fixed it in 3.x, and backported into 2.7.15. So instead of just gathering the patch back, maybe it’s best to update our 2.x version to 2.7.15 with the cross compilation patches. I’m a little bit afraid of the implication (ssl certificates issues on 2.7.x at some point).

I tried installing 2.7.15 with pyenv install 2.7.15 and it installs without errors.


The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .