0

I previously uninstalled Python3.12 (on which I had ran Miniedit-WiFi tool) and left the default Python3.11; however the following console-log error keeps popping out whenever I run a Python script on the Python3.11 regardless of whether I run from a Virtual environment or from the base Python interpreter. (The default Python3.11 is also however still broken too as I cannot install anymore packages using pip despite other projects than the. (This is on Kubuntu-Mantic)

I have ran another TensorFlow ML script that works well in its virtual environment and realized that the issue is in the Python sudoer system; the console output I shared above always comes when I try run a Python script with sudo privilege (eg: sudo python3 /path/to/any/python/script ); So I opened all the setup files in /etc/sudoers.d/ but could not see any trace of the Python3.12 path setup yet the Python path is clean with only the default base Python3.11 & Python3.7 This issue can after I used the sudome app for automating sudo privilege for my Miniedit project in Pycharm when I had Python3.12 install, but after I uninstalled the Python3.12 and cleared it out of the Python path, I can no longer run Python scripts with sudo privilege as the console output suggests its Python path pointing to the Python3.12 which I uninstalled already. Can anyone can help me trace where this output is coming from

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/usr/local/lib/python3.12'
  sys._base_executable = '/usr/local/bin/python3'
  sys.base_prefix = '/usr/local'
  sys.base_exec_prefix = '/usr/local'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/local/bin/python3'
  sys.prefix = '/usr/local'
  sys.exec_prefix = '/usr/local'
  sys.path = [
    '/usr/local/lib/python312.zip',
    '/usr/local/lib/python3.12',
    '/usr/local/lib/python3.12/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 0x00007f5dbb036740 (most recent call first):
  <no Python frame>
2
  • 1
    You've not yet told us what Ubuntu product & release you're using; ie. details of what software stack you're using. On anything python3 related, that detail is helpful (python3 is a system tool, esp. on desktop systems)
    – guiverc
    Commented Feb 6 at 21:30
  • Let me update with those specifications/information; but for now, I have retried running another TensorFlow ML script that works well in its virtual environment and realized that the issue is in the Python sudoer system; the console output I shared above always comes when I try run a Python script with sudo privilege (eg: sudo python3 /path/to/any/python/script ); So I opened all the setup files in /etc/sudoers.d/ but could not see any trace of the Python3.12 path setup yet the Python path is clean with only the default base Python3.11 & Python3.7 (Kubuntu-Mantic) Commented Feb 7 at 12:57

1 Answer 1

0

I realized the base Python3.11 configuration file and base-script were in /usr/local/bin/ so I used in the terminal:

sudo nano /usr/local/bin/python3-config

to edit every instance of 3.12 to 3.11, saved the config file and finally

sudo apt-get update

sudo apt upgrade

Rebooted the PC and it worked!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .