2

In trying to upgrade my Ubuntu virtual server from 17.10 to 18.04.2 LTS:

sudo do-release-upgrade

Results in this output:

Traceback (most recent call last):
  File "/usr/bin/do-release-upgrade", line 8, in <module>
    from DistUpgrade.DistUpgradeVersion import VERSION
ImportError: No module named DistUpgrade.DistUpgradeVersion

This is the first import in that python script so I'm nervous that I've overlooked something fairly obvious about my python install. I checked the python link used in the do-resease-upgrade verison with:

head -n1 /usr/bin/do-release-upgrade
#!/usr/bin/python3

Verifying that the do-release-upgrade point to the correct link:

sudo which do-release-upgrade
/usr/bin/do-release-upgrade

I have verified that I have a symbolic link in /usr/bin/ to python3

lrwxrwxrwx  1 root   root          18 Mar 22 12:34 python3 -> /usr/bin/python3.6
-rwxr-xr-x  2 root   root     4568920 Oct  3  2017 python3.6

And should note that reinstalling python3 does not change the result. I've made no other changes to python recently.

If I run the command in python /usr/bin/python3.6 the error generated changes from ImportError to ModuleNotFound as shown below:

>>> from DistUpgrade.DistUpgradeVersion import VERSION
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'DistUpgrade'

I'm not familiar enough with this to know whether I should be searching for the DistUpgrade module to install or if there is another issue at play.

Reconfiguring the packages with sudo dpkg --configure -a also does not fix the problem.

I did take a look at askubuntu.com/q/565107/301745 but was experiencing none of the other issues that the user was experiencing. Furthermore, I also have not attempted to remove any versions of python, as this user had. (Though, in my troubleshooting I did reinstall python3 and saw no change in behavior.)

Thank you in advance.

Soulie
  • 21
  • 1
  • 4

2 Answers2

2

Solved: This issue is a python version issue, try to install python 3.6 which is minimum requirement to import the packages.

If this failed don't worry keep following all the steps:

sudo add-apt-repository ppa:jonathonf/python-3.6

Then check updates and install Python 3.6 via commands:

sudo apt-get update

sudo apt-get install python3.6

Now you have three Python versions, use python command for version 2.7, python3 for version 3.5, and/or python3.6 for version 3.6.1

To make python3 use the new installed python 3.6 instead of the default 3.5 release, run following 2 commands

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

Finally, switch between the two python versions for python3 via command:

sudo update-alternatives --config python3

After selecting version 3.6:

python3 -V

UPDATE: due to this bug, gnome-terminal won’t launch after step 3, a workaround is running following commands to recreate the symlink:

sudo rm /usr/bin/python3

sudo ln -s python3.5 /usr/bin/python3

Check this resource: http://ubuntuhandbook.org/index.php/2017/07/install-python-3-6-1-in-ubuntu-16-04-lts/

Now if you face another error like this:

Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

The Fix If you experience the error above run each command below.

sudo apt-get update

sudo apt-get upgrade -y

sudo apt-get dist-upgrade

sudo do-release-upgrade

Resource: https://www.liquidweb.com/kb/troubleshooting-please-install-available-updates-release-upgrading/ Hope it help and resolve your issue too.

0

I had the same problem, because I disabled the snapd.service. Check the snapd.service with the command : sudo systemctl status snapd.service

If it's inactive:

● snapd.service - Snap Daemon Loaded: loaded (/lib/systemd/system/snapd.service; disabled; vendor preset: enabled) Active: inactive (dead)

Start the service with sudo systemctl start snapd.service then start the release upgrade

Kevin Bowen
  • 20,055
  • 57
  • 82
  • 84