skip to Main Content

I’m trying to dockerize my python code but centos latest image does not have python3 in the repository packages at all .

I tried:

Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.karneval.cz
 * extras: mirror.karneval.cz
 * updates: mirror.karneval.cz
=============================================================================================== Matched: python3 ===============================================================================================
nbdkit-plugin-python-common.x86_64 : Python 2 and 3 plugin common files for nbdkit
pki-base.noarch : Certificate System - PKI Framework
pki-base-java.noarch : Certificate System - Java Framework
pki-ca.noarch : Certificate System - Certificate Authority
pki-javadoc.noarch : Certificate System - PKI Framework Javadocs
pki-kra.noarch : Certificate System - Key Recovery Authority
pki-server.noarch : Certificate System - PKI Server Framework
pki-symkey.x86_64 : Symmetric Key JNI Package
pki-tools.x86_64 : Certificate System - PKI Tools
[root@4b59e89e3e4e /]#

The actual result would be to actually have python3 in the default repositories because python 2 will reach end of life. And also because if you run any python2 installation with pip it will CLEARLY show you that it’s end of life so centos should have it by default

Please if you could be so kind to confirm this so I can open a bug report to centos or remind them that python3 is vital in the default repository

2

Answers


  1. Well i tested some other images as well like Ubuntu:latest and alpine:latest and python3 not installed by default but it’s in the repos and you can install by the package manager

    In Centos:latest I can confirm that python3 isn’t in the default configured Repos of the image
    However you can find it in other Repos as mentioned in this tutorial from digital ocean and I quote

    CentOS is derived from RHEL (Red Hat Enterprise Linux), which has stability as its primary focus. Because of this, tested and stable versions of applications are what is most commonly found on the system and in downloadable packages, so on CentOS you will only find Python 2.

    So to you can go ahead and file the issue as you want but to save you sometime till they fix this you can follow the tutorial which is old one

    Login or Signup to reply.
  2. I need python3.5 or later in centos:latest Docker image, and I found that I can get it easily by:

    RUN yum -y install epel-release
    RUN yum -y install python3 python3-pip
    

    This way I get:

    [user@machine /]# python3 --version
    Python 3.6.8
    

    And I can use “pip3 install package” to install additional python packages. It is not in default packages, but in the https://fedoraproject.org/wiki/EPEL . I suggest to specify python version on first line of python script: #!/usr/bin/env python3

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search