Search code examples
pythonlinuxrhelpyenv

Can't install python by pyenv on RHEL


Installed pyenv on RHEL7.6.

Installed necessary libraries as wiki

sudo yum install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite \
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils

Check the install available list

$ pyenv install --list | grep 3.8.2
  3.8.2

When install it got error:

$ pyenv install 3.8.2
Downloading Python-3.8.2.tar.xz...
-> https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
error: failed to download Python-3.8.2.tar.xz

BUILD FAILED (Red Hat Enterprise Linux Server 7.6 using python-build 1.2.18-7-gae4d489)

Even tried to set a proxy but still the same error.

The OS information is

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.6"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.6 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.6:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.6
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.6"

Solution

  • Try downloading the source package from https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz and putting it in the pyenv cache $(pyenv root)/cache/.

    Then retry pyenv install 3.8.2

    See https://github.com/pyenv/pyenv/issues/1476