Python Troubleshooting and Installation Summary

This document summarizes the issues encountered and troubleshooting steps taken based on the provided command history. It also provides guidance on proper Python installation.

Issues Encountered

  1. Terminal Failure After Changing Python Version:
    • After installing Python 3.14 and setting it as the default using update-alternatives, both gnome-terminal and terminator failed to launch.
    • Errors were related to missing or incompatible Python libraries (psutil and gi).
    • gnome-terminal also had a typo in it's shebang.
  2. Incompatible Python Libraries:
    • The alpha version of Python 3.14 caused incompatibility issues with psutil and gi libraries, which are essential for the terminal applications.

Troubleshooting Steps

  1. Corrected gnome-terminal Shebang:
    • Used sudo vim /usr/bin/gnome-terminal to correct the shebang from /usri/bin/python3 to /usr/bin/python3.
  2. Switched Python Versions:
    • Used sudo update-alternatives --config python3 to switch back to a stable Python version (Python 3.10).
  3. Reinstalled Python Libraries:
    • sudo apt-get install --reinstall python3-psutil gir1.2-glib-2.0 python3-gi was used to reinstall the python modules that the terminal applications use.
  4. Rebooted the system:
    • Reboots where used in an attempt to solve the issue.

Proper Python Installation and Version Management

  1. Adding the DeadSnakes PPA (for newer Python versions):

    • sudo add-apt-repository ppa:deadsnakes/ppa adds the DeadSnakes PPA, which provides newer Python versions.
    • sudo apt update updates the package list.
  2. Installing a Specific Python Version:

    • sudo apt-get install python3.11 (or python3.14) installs the desired Python version.
  3. Managing Python Versions with update-alternatives (Use with Caution):

    • sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 registers a Python version with update-alternatives.
    • sudo update-alternatives --config python3 allows you to select the default Python version.
    • Recommendation: Avoid changing the system's default Python version unless absolutely necessary.
  4. Using Virtual Environments (Recommended):

    • For project-specific Python versions and dependencies, use virtual environments:
      • python3.14 -m venv my_env creates a virtual environment.
      • source my_env/bin/activate activates the environment.
      • deactivate deactivates the environment.
    • Virtual environments isolate project dependencies and prevent system-wide conflicts.
    • This is the recommended way to use python 3.14.

Key Recommendations


Written by A.M. Rinas