Dependencies issues after upgrading from 22.04LTS to 24.04LTS

Hi,

After upgrading recently from 22.04LTS to 24.04LTS, I realized that my Samba share was not longer working and samba itself was no longer installed.

Trying to install it, I am getting a dependencies issue on a python3.2 library:

sudo apt install samba
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpython3.12t64 : Depends: libpython3.12-stdlib (= 3.12.3-1ubuntu0.3) but 3.12.7-1+jammy1 is to be installed

Something obviously went wrong somewhere in install/apt repositories as the default python on my 24.04LTS is 3.12.7 so not sure why there are still some dependencies around python 3.12.3.

The same issue is preventing me to install anything python dependent such as vim.

Any clue on how I could resolve this issue?
Thanks,

So it turns out the issue was that prior to upgrading to 24.04LTS I had install Python 3.12.7 which in turns was used as the default for 24.04LTS rather than the 3.12.3 packaged with Noble.

After running the below command to downgrade Python from 3.12.7 to 3.12.3:

sudo apt install '?installed?source-package(^python3.12$)/noble-updates'

The above dependency issue got resolved and I can install other Python dependent packages normally.

This is a lesson for everyone. We strongly recommend not replacing the system version of python. Instead use tools like virtualenvs, uv, or conda to manage python environments. Replacing the system python will almost always come back to bite you months or years later.