{"id":3817,"date":"2024-06-11T17:45:35","date_gmt":"2024-06-11T22:45:35","guid":{"rendered":"https:\/\/osric.com\/chris\/accidental-developer\/?p=3817"},"modified":"2024-06-11T17:45:35","modified_gmt":"2024-06-11T22:45:35","slug":"default-version-of-python-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2024\/06\/default-version-of-python-on-rocky-linux-8\/","title":{"rendered":"Default version of Python on Rocky Linux 8"},"content":{"rendered":"<p>Some questions came up at work today about the default version of Python on Rocky Linux 8. Someone said it was Python 3.6.8, others said it was Python 3.9.<\/p>\n<p>I decided to test this empirically and install Rocky Linux 8.10 from the minimal ISO. The answer is:<\/p>\n<p>You&#8217;re all wrong. There is no default version of Python on Rocky Linux 8. (At least, not on the minimal ISO, i.e. <code>Rocky-8.10-x86_64-minimal.iso<\/code>.)<\/p>\n<p>There is, however, <code>platform-python<\/code>. Rocky Linux needs Python as a dependency for various other tools. That version is, in fact, Python 3.6.8:<\/p>\n<pre><code>[root@localhost ~]# dnf info platform-python\r\nLast metadata expiration check: 0:24:11 ago on Tue 11 Jun 2024 05:49:30 PM EDT.\r\nInstalled Packages\r\nName         : platform-python\r\nVersion      : 3.6.8\r\nRelease      : 62.el8_10.rocky.0\r\nArchitecture : x86_64\r\nSize         : 40 k\r\nSource       : python3-3.6.8-62.el8_10.rocky.0.src.rpm\r\nRepository   : @System\r\nFrom repo    : anaconda\r\nSummary      : Internal interpreter of the Python programming language\r\nURL          : https:\/\/www.python.org\/\r\nLicense      : Python\r\nDescription  : This is the internal interpreter of the Python language for the system.\r\n             : To use Python yourself, please install one of the available Python 3 packages,\r\n             : for example python36.<\/code><\/pre>\n<p>As the description mentions, if you, as a user of the Linux system, want to run Python, you&#8217;ll need to install it. Rocky Linux provides several packages:<\/p>\n<pre><code>[root@localhost ~]# dnf install python\r\nLast metadata expiration check: 0:30:25 ago on Tue 11 Jun 2024 05:49:30 PM EDT.\r\nNo match for argument: python\r\nThere are following alternatives for \"python\": python2, python3.11, python3.12, python36, python38, python39\r\nError: Unable to find a match: python<\/code><\/pre>\n<p>I decided to install all of the versions offered. After installing, I checked the version of each:<\/p>\n<pre><code>[root@localhost ~]# python --version\r\n-bash: python: command not found\r\n[root@localhost ~]# python2 --version\r\nPython 2.7.18\r\n[root@localhost ~]# python3 --version\r\nPython 3.6.8\r\n[root@localhost ~]# python3.8 --version\r\nPython 3.8.17\r\n[root@localhost ~]# python3.9 --version\r\nPython 3.9.19\r\n[root@localhost ~]# python3.11 --version\r\nPython 3.11.7\r\n[root@localhost ~]# python3.12 --version\r\nPython 3.12.1<\/code><\/pre>\n<p>There is no default <code>python<\/code>, although you can easily create that alias\/link:<\/p>\n<pre><code>[root@localhost ~]# ln \/usr\/bin\/python3.12 \/usr\/bin\/python\r\n[root@localhost ~]# python --version\r\nPython 3.12.1<\/code><\/pre>\n<p>However, it appears that Rocky 8 will make Python 3.6.8 the target of the python3 alias\/link if it is installed. I am basing this claim on the following:<\/p>\n<ol>\n<li>I uninstalled all python3* versions: <code>dnf remove python36 python38 python39 python311 python312<\/code><\/li>\n<li>I installed <code>python312<\/code>. <code>python --version<\/code> showed Python 3.12.1<\/li>\n<li>I installed <code>python36<\/code>. <code>python --version<\/code> showed Python 3.6.8<\/li>\n<li>I installed <code>python39<\/code>. <code>python --version<\/code> still showed Python 3.6.8<\/li>\n<\/ol>\n<p>That suggests it&#8217;s not just the most-recently installed Python 3 version that becomes the target of the <code>python3<\/code> link. Python 3.6.8, if installed, seems to take precedence over other versions (or at least other versions won&#8217;t overwrite the link).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some questions came up at work today about the default version of Python on Rocky Linux 8. Someone said it was Python 3.6.8, others said it was Python 3.9. I decided to test this empirically and install Rocky Linux 8.10 from the minimal ISO. The answer is: You&#8217;re all wrong. There is no default version &hellip; <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2024\/06\/default-version-of-python-on-rocky-linux-8\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Default version of Python on Rocky Linux 8<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86],"tags":[358,578],"class_list":["post-3817","post","type-post","status-publish","format-standard","hentry","category-python","tag-python","tag-rocky-linux"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/3817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=3817"}],"version-history":[{"count":5,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/3817\/revisions"}],"predecessor-version":[{"id":3823,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/3817\/revisions\/3823"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=3817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=3817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=3817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}