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
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
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
I need python3.5 or later in centos:latest Docker image, and I found that I can get it easily by:
This way I get:
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