Linux Notes: Python FUBAR
- The information presented here is intended for educational use by qualified computer technologists.
- The information presented here is provided free of charge, as-is, with no warranty of any kind.
Edit: 2024-10-19
back to: my
Linux Notes (index)
# =============================================================================
# title : python39-fubar-20240804.txt
# author: Neil Rieck
# edit : 2024-08-04
# notes :
# 1) for the past 2 years, our CentOS7 system hosted 3 python flavors:
# python2.7 -built-in in to support OS utilities like yum + firewall-cmd
# python3.6.8 -installed from an EL7 repo
# python3.9.13 -built from source code since not available from the repo7;
so installed outside of yum and rpm
# 2) last month I used ELevate-leapp to migrate this system to AlmaLinux8:
# python2.7 -was not removed; but you can remove it whenever you wish
# python3.6.8 -now considered the base-python for supporting yum etc.
# python3.9.13 -was not touched (but was not updated to python3.9.19 since
# AlmaLinux8 does not know about it)
# 3) I tried using yum/dnf to install python3.9.19 overtop of python3.9.13 but
# that failed spectacularly which required a manual removal. Read on...
# =============================================================================
# ============================================================================= start
# become root (danger danger danger)
#
su -
# ============================================================================= start
# what kind of system?
#
[root@kawc0f neil]# cat /etc/os*
NAME="AlmaLinux"
VERSION="8.10 (Cerulean Leopard)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="AlmaLinux 8.10 (Cerulean Leopard)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:8::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"
ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8"
ALMALINUX_MANTISBT_PROJECT_VERSION="8.10"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
SUPPORT_END=2029-06-01
cat: /etc/ostree: Is a directory
# ============================================================================= start
# check installed pythons (this system hosts more than one)
# but yum/dnf/rpm only know about one
#
[root@kawc0f neil]# dnf list installed python3\?.x86_64
Installed Packages
python36.x86_64 3.6.8-39.module_el8.10.0+3769+3838165b @System
# ============================================================================= start
# and yet, python3.9.13 works (it was built-installed by me from source
# code in 2022 because 3.9 was not available from the centos7 repo)
#
[root@kawc0f neil]# python3.9
Python 3.9.13 (main, Apr 19 2023, 07:35:25)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("this works")
this works
>>>
[root@kawc0f neil]#
#============================================================================== start
# create a list of the currently installed modules in python3.9 (just in case)
#
python3.9 -m pip > pip39-kawc0f-freeze-20240804.txt
#============================================================================== start
#
# so install the new version (3.8.19) over top of the existing code
#
[root@kawc0f neil]# dnf install python39.x86_64
Last metadata expiration check: 0:05:18 ago on Sun 04 Aug 2024 07:41:29 AM EDT.
Dependencies resolved.
====================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================
Installing:
python39 x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa appstream 33 k
Installing dependencies:
python39-libs x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa appstream 8.2 M
python39-pip-wheel noarch 20.2.4-9.module_el8.10.0+3765+2f9a457d appstream 1.1 M
python39-setuptools-wheel noarch 50.3.2-5.module_el8.10.0+3765+2f9a457d appstream 496 k
Installing weak dependencies:
python39-pip noarch 20.2.4-9.module_el8.10.0+3765+2f9a457d appstream 1.9 M
python39-setuptools noarch 50.3.2-5.module_el8.10.0+3765+2f9a457d appstream 870 k
python39-tkinter x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa appstream 326 k
Enabling module streams:
python39 3.9
Transaction Summary
====================================================================================================================================
Install 7 Packages
Total download size: 13 M
Installed size: 47 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm 168 kB/s | 33 kB 00:00
(2/7): python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.8 MB/s | 1.1 MB 00:00
(3/7): python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.7 MB/s | 1.9 MB 00:01
(4/7): python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.7 MB/s | 870 kB 00:00
(5/7): python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.5 MB/s | 496 kB 00:00
(6/7): python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm 1.5 MB/s | 326 kB 00:00
(7/7): python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm 5.1 MB/s | 8.2 MB 00:01
------------------------------------------------------------------------------------------------------------------------------------
Total 7.0 MB/s | 13 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 1/7
Installing : python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 2/7
Installing : python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 3/7
Installing : python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 4/7
Installing : python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 5/7
Running scriptlet: python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 5/7
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
Installing : python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
Running scriptlet: python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
Installing : python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 7/7
Running scriptlet: python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 7/7
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
Verifying : python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 1/7
Verifying : python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 2/7
Verifying : python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 3/7
Verifying : python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 4/7
Verifying : python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 5/7
Verifying : python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
Verifying : python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 7/7
Installed:
python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch
python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch
python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch
python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch
python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
Complete!
[root@kawc0f neil]#
# ============================================================================= start
# notice the "failed to link" errors above.
# Also, this command indicates that the old python is still present (huh?)
#
Python 3.9.13 (main, Apr 19 2023, 07:35:25)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
# ============================================================================= start
# this command indicates that the whole python3.9 environment is FUBARed
# (cannot find python3.9 libraries)
#
[root@kawc0f neil]# python3.9 -m pip list
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.9/site-packages/pip/__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "/usr/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
from pip._internal.utils.misc import ensure_dir
File "/usr/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 33, in <module>
from pip._internal.locations import (
File "/usr/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
from . import _sysconfig
File "/usr/lib/python3.9/site-packages/pip/_internal/locations/_sysconfig.py", line 7, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/usr/lib/python3.9/site-packages/pip/_i)
[root@kawc0f neil]#
# ============================================================================= start
# so lets uninstall python3.9
#
[root@kawc0f neil]# dnf erase python39.x86_64
Dependencies resolved.
====================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================
Removing:
python39 x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa @appstream 24 k
Removing unused dependencies:
python39-libs x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa @appstream 32 M
python39-pip noarch 20.2.4-9.module_el8.10.0+3765+2f9a457d @appstream 7.8 M
python39-pip-wheel noarch 20.2.4-9.module_el8.10.0+3765+2f9a457d @appstream 1.1 M
python39-setuptools noarch 50.3.2-5.module_el8.10.0+3765+2f9a457d @appstream 3.8 M
python39-setuptools-wheel noarch 50.3.2-5.module_el8.10.0+3765+2f9a457d @appstream 550 k
python39-tkinter x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa @appstream 1.6 M
Transaction Summary
====================================================================================================================================
Remove 7 Packages
Freed space: 47 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 1/7
Erasing : python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 2/7
Erasing : python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 3/7
Running scriptlet: python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 3/7
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
Erasing : python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 4/7
Running scriptlet: python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 4/7
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
Erasing : python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 5/7
Running scriptlet: python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 5/7
Erasing : python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 6/7
Erasing : python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 7/7
Running scriptlet: python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 7/7
Verifying : python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 1/7
Verifying : python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 2/7
Verifying : python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 3/7
Verifying : python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 4/7
Verifying : python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 5/7
Verifying : python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
Verifying : python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 7/7
Removed:
python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch
python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch
python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch
python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch
python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
Complete!
# ============================================================================= start
# notice the "failed to link" messages above
# this file will need to be erased via "rm" or renamed via "mv"
# let's locate other python3.9 files
[root@kawc0f bin]# find / -name python3.9\* -exec ls -lad {} \;
-rw-r--r--. 1 neil admgrp 1761463 May 17 2022 /home/neil/Python-3.9.13/Doc/data/python3.9.abi
find: ‘/run/user/1000/gvfs’: Permission denied
-rwxr-xr-x. 1 root root 3073 Apr 19 2023 /usr/bin/python3.9-config
drwxr-xr-x. 36 root root 8192 May 30 13:05 /usr/lib/python3.9
drwxr-xr-x. 4 root root 44 Aug 4 08:02 /usr/lib64/python3.9
-rw-r--r--. 1 root root 18232 Apr 19 2023 /usr/share/man/man1/python3.9.1
drwxr-xr-x. 4 root root 4096 Aug 4 08:02 /usr/include/python3.9
[root@kawc0f bin]#
# ============================================================================= start
# these will need to be erased like so
#
[root@kawc0f neil]# rm /usr/bin/python3.9-config
rm: remove regular file '/usr/bin/python3.9-config'? y
[root@kawc0f neil]# rm /usr/share/man/man1/python3.9.1
rm: remove regular file '/usr/share/man/man1/python3.9.1'? y
[root@kawc0f neil]# rm -fr /usr/lib/python3.9
[root@kawc0f neil]# rm -fr /usr/lib64/python3.9
[root@kawc0f neil]# rm -fr /usr/include/python3.9
[root@kawc0f neil]#
# ============================================================================= start
# okay, reinstall python3.9.19 for a second time
#
[root@kawc0f neil]# dnf install python39.x86_64
Last metadata expiration check: 0:37:33 ago on Sun 04 Aug 2024 07:41:29 AM EDT.
Dependencies resolved.
====================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================
Installing:
python39 x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa appstream 33 k
Installing dependencies:
python39-libs x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa appstream 8.2 M
python39-pip-wheel noarch 20.2.4-9.module_el8.10.0+3765+2f9a457d appstream 1.1 M
python39-setuptools-wheel noarch 50.3.2-5.module_el8.10.0+3765+2f9a457d appstream 496 k
Installing weak dependencies:
python39-pip noarch 20.2.4-9.module_el8.10.0+3765+2f9a457d appstream 1.9 M
python39-setuptools noarch 50.3.2-5.module_el8.10.0+3765+2f9a457d appstream 870 k
python39-tkinter x86_64 3.9.19-1.module_el8.10.0+3849+a48d89aa appstream 326 k
Transaction Summary
====================================================================================================================================
Install 7 Packages
Total download size: 13 M
Installed size: 47 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm 156 kB/s | 33 kB 00:00
[MIRROR] python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch.rpm: Curl error (18): Transferred a partial file for http://mir]
[MIRROR] python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm: Curl error (18): Transferred a partial file for http://mi]
[MIRROR] python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch.rpm: Curl error (18): Transferred a partial file for http]
(2/7): python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.4 MB/s | 1.1 MB 00:00
(3/7): python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.3 MB/s | 1.9 MB 00:01
(4/7): python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.6 MB/s | 870 kB 00:00
(5/7): python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch.rpm 1.4 MB/s | 496 kB 00:00
(6/7): python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm 1.2 MB/s | 326 kB 00:00
(7/7): python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64.rpm 4.1 MB/s | 8.2 MB 00:02
------------------------------------------------------------------------------------------------------------------------------------
Total 5.7 MB/s | 13 MB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 1/7
Installing : python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 2/7
Installing : python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 3/7
Installing : python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 4/7
Installing : python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 5/7
Running scriptlet: python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 5/7
Installing : python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
Running scriptlet: python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
Installing : python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 7/7
Running scriptlet: python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 7/7
Verifying : python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 1/7
Verifying : python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 2/7
Verifying : python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 3/7
Verifying : python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch 4/7
Verifying : python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 5/7
Verifying : python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch 6/7
Verifying : python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64 7/7
Installed:
python39-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
python39-libs-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
python39-pip-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch
python39-pip-wheel-20.2.4-9.module_el8.10.0+3765+2f9a457d.noarch
python39-setuptools-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch
python39-setuptools-wheel-50.3.2-5.module_el8.10.0+3765+2f9a457d.noarch
python39-tkinter-3.9.19-1.module_el8.10.0+3849+a48d89aa.x86_64
Complete!
# ============================================================================= start
# the second install looks clean so now test python3.9
#
[root@kawc0f neil]# python3.9
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3.9'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/bin/python3.9'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/usr'
sys.platlibdir = 'lib'
sys.executable = '/usr/bin/python3.9'
sys.prefix = '/usr'
sys.exec_prefix = '/usr'
sys.path = [
'/usr/lib/python39.zip',
'/usr/lib/python3.9',
'/usr/lib/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f6fdac85740 (most recent call first):
<no Python frame>
[root@kawc0f neil]# python3
Python 3.6.8 (default, May 23 2024, 12:29:56)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@kawc0f neil]# python3.9
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3.9'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/bin/python3.9'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/usr'
sys.platlibdir = 'lib'
sys.executable = '/usr/bin/python3.9'
sys.prefix = '/usr'
sys.exec_prefix = '/usr'
sys.path = [
'/usr/lib/python39.zip',
'/usr/lib/python3.9',
'/usr/lib/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f55fa39c740 (most recent call first):
<no Python frame>
[root@kawc0f neil]# exit
exit
[neil@kawc0f ~]$
# ============================================================================= start
# need to delete some more left-over crud (possibly shared libraries)
# cmd : yum erase python39.x86_64
# output: not shown
# locate left-over crud
# cmd1: find / -iname libpython3.9\*.so\* -exec ls -lad {} \;
# cmd2: find / -iname \*python3.9\* -exec ls -lad {} \;
[root@kawc0f neil]# find / -iname \*python3.9\*.so\* -exec ls -lad {} \;
-rwxr-xr-x. 2 root root 17312600 Apr 19 2023 /home/neil/Python-3.9.13/libpython3.9.so.1.0
-rwxr-xr-x. 2 root root 17312600 Apr 19 2023 /home/neil/Python-3.9.13/libpython3.9.so
find: ‘/run/user/1000/gvfs’: Permission denied
lrwxrwxrwx. 1 root root 19 Apr 19 2023 /usr/lib/libpython3.9.so -> libpython3.9.so.1.0
-rwxr-xr-x. 1 root root 17312600 Apr 19 2023 /usr/lib/libpython3.9.so.1.0
# ============================================================================= start
# move one file to a safe place then delete the link
#
[root@kawc0f neil]# mv /usr/lib/libpython3.9.so.1.0 /home/neil
[root@kawc0f neil]# rm -f /usr/lib/libpython3.9.so
# ============================================================================= start
# install python3.9.19 for a third time
# cmd : yum install python3.9
# output: not shown
#
[root@kawc0f neil]# python3.9
Python 3.9.19 (main, May 30 2024, 13:03:52)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
# ============================================================================= start
# now restore the original python3.9 library environment (directed by the freeze file)
# ---
# cmd: python3.9 -m pip install --upgrade pip --trusted-host pypi.org
# cmd: python3.9 -m pip install --upgrade setuptools --trusted-host pypi.org
# cmd: python3.9 -m pip install --upgrade -r pip39-kawc0f-freeze-20240804.txt --trusted-host pypi.org
# ============================================================================= start
# one final sanity test
#
[root@kawc0f neil]# python3.9 -m pip list
Package Version
---------------------- -----------
attrs 23.1.0
bcrypt 4.0.1
certifi 2022.12.7
cffi 1.15.1
charset-normalizer 3.1.0
cryptography 40.0.2
idna 3.4
isodate 0.6.1
lxml 4.9.2
mysql-connector-python 8.0.33
numpy 2.0.1
pandas 2.2.2
paramiko 2.9.2
pip 24.2
platformdirs 3.4.0
protobuf 3.20.3
pycparser 2.21
PyNaCl 1.5.0
pysftp 0.2.9
pysftp-extension 0.2.13
python-dateutil 2.9.0.post0
pytz 2023.3
requests 2.28.2
requests-file 1.5.1
requests-toolbelt 0.10.1
setuptools 72.1.0
sh 2.0.3
six 1.16.0
tzdata 2024.1
urllib3 1.26.15
wheel 0.43.0
zeep 4.2.1
# ============================================================================= no more
Back to
Home
Neil Rieck
Waterloo, Ontario, Canada.