skip to Main Content

I have a standard Ubuntu remote server from HostWinds that is set up per their normal settings, Ubuntu 22.04.5 LTS. I added MySQL, but otherwise I have made very few changes except I installed Python 3.13 because I wanted to use the latest Python version rather than the standard Python 3.10.12 that comes with Ubuntu. Now I can’t update the server at all and everything I try to install gives similar errors. For example, running the command:
sudo apt update && sudo apt upgrade -y
results in the following error:

Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libpython3.13 : Depends: libpython3.13-stdlib (= 3.13.1-1+jammy1) but 3.13.0-1+jammy1 is installed
 libpython3.13-dev : Depends: libpython3.13-stdlib (= 3.13.1-1+jammy1) but 3.13.0-1+jammy1 is installed
 python3.13-dev : Depends: python3.13 (= 3.13.1-1+jammy1) but 3.13.0-1+jammy1 is installed

I have tried the apt --fix-broken install command recommended by the error of course, but that gives an error also that is full of references to Python 3.13. I am almost positive I simply shouldn’t have messed with Python by installing 3.13. I should have stuck with 3.10.12, but how do I go back without just restarting the server? I really don’t want to set up the non-root user and database and database usernames and permissions on the database and everything again if I don’t have to.

Also, I get the same error when I try to install nginx, which I would like to install and now I can’t.

I realize my title assumes a particular cause of my error. At a minimum, I want to at least eliminate the Python 3.13 installation as a possible cause so I can move on since I am not using it at all anyway. I really try to stick to ‘standard’ and I am kicking myself for installing Python 3.13, but I did and now I’m stuck.

How do I get back to where I didn’t install Python 3.13? Or what else could be causing this error? I want to be able to update my server and install nginx.

2

Answers


  1. I faced a similar problem. What ultimately got me past the error was to remove enough Python3.13 packages at once so any conflicts were resolved. I got to this point by starting with one package, then adding any Python3.13 packages referenced in the error, and repeating this process until there was no more error. This means that this is probably not the perfect way of solving it.

    This is what ultimately passed without errors:

    sudo apt remove --purge python3.13 libpython3.13-minimal libpython3.13-stdlib

    After this I was able to reinstall Python3.13 without causing errors on subsequent apt commands.

    Some of the intermediate errors for reference:

    python3.13-venv : Depends: python3.13 (= 3.13.1-1+jammy1) but 3.13.0-1+jammy1 is installed

    $ sudo apt --fix-broken install

    Unpacking python3.13 (3.13.1-1+jammy1) over (3.13.0-1+jammy1) ...
    dpkg: error processing archive /var/cache/apt/archives/python3.13_3.13.1-1+jammy
    1_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/python3.13', which is also in package python3.13-minimal 3.13.0-1+jammy1
    dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
    Preparing to unpack .../libpython3.13-stdlib_3.13.1-1+jammy1_amd64.deb ...
    Unpacking libpython3.13-stdlib:amd64 (3.13.1-1+jammy1) over (3.13.0-1+jammy1) ...
    

    (failed)

    $ sudo apt remove --purge python3.13 libpython3.13-minimal libpython3.13-stdlib

    Removing libpython3.13-stdlib:amd64 (3.13.0-1+jammy1) ...
    Removing python3.13-minimal (3.13.0-1+jammy1) ...
    Unlinking and removing bytecode for runtime python3.13
    E: py3clean:65: cannot find magic tag for Python 3.13: python3.13 -c 'import imp; print(imp.get_tag()
    )' failed with status code 1
    Removing libpython3.13-minimal:amd64 (3.13.0-1+jammy1) ...
    Processing triggers for man-db (2.10.2-1) ...
    (Reading database ... 217459 files and directories currently installed.)
    Purging configuration files for libpython3.13-minimal:amd64 (3.13.0-1+jammy1) ...
    dpkg: warning: while removing libpython3.13-minimal:amd64, directory '/usr/lib/python3.13' not empty so not removed
    Purging configuration files for python3.13-minimal (3.13.0-1+jammy1) ...
    

    (succeeded)

    Login or Signup to reply.
  2. In your terminal, do:

    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libpython3.13-stdlib_3.13.1-1+jammy1_amd64.deb
    

    Then run:

    sudo apt -f install
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search