0
votes

Whenever i try sudo apt-get upgrade or try to install any other package i get the above error. Is there any way to solve it?? Using ubuntu 16.04

Removing python3-distro-info (0.14ubuntu0.2) ...
Setting up ubuntu-advantage-tools (27.0~16.04.1) ...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

3
Does this answer your question? askubuntu.com/questions/1336425/… - Jan Wilamowski
i have already tried and it didnot work - Luff li

3 Answers

0
votes

I have the same problem and try to solve then it work for me.

My environment:

  • OS: ubuntu 18.04 LTS
  • python version: 3.6.9(system default) , manual install 3.8.7

System python path have been link to python 3.8 when I install python 3.8, so any process use python will call python 3.8 and use pip3.8 site-packages, not use system dist-packages(python 3.6). But python 3.8 uaclinet(install by pip) is different from uaclinet in dist-packages(ubuntu-advantage-tools provide). then I use apt upgrade

設定 ubuntu-advantage-tools (27.0.2~18.04.1) ...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
 installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 1
處理時發生錯誤:
 ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

So, I copy the uaclinet(in dist-packages) to python 3.8 site-packages and run upgrade again, then it works( maybe has compatibility problems )

設定 ubuntu-advantage-tools (27.0.2~18.04.1) ...
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
   Affected packages: ubuntu-advantage-tools:amd64

I think if your use system python , you can use comment by Jan Wilamowski,

0
votes

You should install opcua and opcua-client with default python command:

python -m pip install --upgrade opcua

python -m pip install --upgrade opcua-client
0
votes

This problem appeared for me after upgrading to Ubuntu 18.04 from 16.04.

I updated opcua and opcua-client as suggested with python -m pip install, and also with pip3 install, to get it updated in python3 packages, and the problem remained.
I have system python3 installed in /usr/bin/python3 (version 3.6), and another version in /usr/local/bin/python3 (version 3.8) which is the default python3. I'm not sure why, but the uaclient.entitlements module can be loaded properly with /usr/bin/python3, but not with /usr/local/bin/python3

Instead of changing the location of the uaclient package, the following worked for me:

I used update-alternatives to choose which python3 will be used by default, either system python3 which is /usr/bin/python3.6, or the updated python3 which is installed in /usr/local/bin/python3.8 as described here: https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu

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

sudo update-alternatives --install /usr/local/bin/python3 python3 /usr/local/bin/python3.8 2

Then, choose /usr/bin/python3.6 as the default by running:

sudo update-alternatives --config python3

A symlink is created as /etc/alternatives/python3 that points to the chosen default python3.

Since the way I set the alternatives results in /usr/local/bin/python3.8 as the automatic default python3, the symlink /usr/bin/python3 -> python3.6 is removed. But this symlink is still needed for dependencies/functions that use system python through /usr/bin/python3, so I added back the sym link:

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

By setting /usr/bin/python3.6 as the default instead of /usr/local/bin/python3.8, then uaclient.entitlements can be loaded properly. This worked for me to install and upgrade packages where this uaclient.entitlements ModuleNotFoundError was occurring. Just have to switch back to using /usr/local/bin/python3.8 when finished installing. But I think now that ubuntu-advantage-tools is configured by getting through this error, there doesn't seem to be a need to switch to /usr/bin/python3.6 as the default anymore for installing packages.