davidfoerster / aptsources-cleanup

Detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries (as requested in https://askubuntu.com/a/762815/175814).
MIT License
667 stars 85 forks source link

Python 3.6 is unsupported #1

Closed sergiuszkierat closed 6 years ago

sergiuszkierat commented 6 years ago

It seems not to work with the newest version of python

[21:39:27] skierat ~ python3 -V
Python 3.6.5
[21:39:50] skierat ~ sudo apt-get install python3-apt
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-apt is already the newest version (1.1.0~beta1ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[21:40:02] skierat ~ sudo ./apt-remove-duplicate-source-entries.py
Error: No module named 'apt_pkg'.

Do you have the 'python3-apt' package installed?
You can do so with 'sudo apt-get install python3-apt'.

whereas it works perfectly with version 3.5

[21:40:18] skierat ~ python3 -V
Python 3.5.2
[21:41:56] skierat ~ sudo ./apt-remove-duplicate-source-entries.py
No duplicate entries were found.
davidfoerster commented 6 years ago

Please install the apt module for the Python installation to which the /usr/bin/python3 executable belongs.

The python3-apt package is only meant for the Python installation related to the Python 3 installation that comes through Ubuntu's (or Debian's) package manager. It looks like you installed a different Python version as /usr/bin/python3 which is not recommended in Ubuntu (and many other Linux distros) because some system tools and many installation instructions (including this one) rely on it belonging to the pre-packaged Python installation.

I'm closing the issue because it's a system configuration issue.

sergiuszkierat commented 6 years ago

@davidfoerster I installed python 3.6 following this tutorial

Since it is still unclear for me, could you share an alternative source of knowledge which might help?

davidfoerster commented 6 years ago

The problem is that python3-apt from the Ubuntu Xenial package repositories is incompatible with other Python versions than 3.5. More generally, all Python modules with native code are incompatible with other major revisions of Pythons than the one they were built for.

Thus setting /usr/bin/python3 to point to a different Python installation is asking for trouble as you can see. I recommend that you undo this. You can still use Python 3.6 through /usr/bin/python3.6 or simply python3.6.

If you need more Ubuntu troubleshooting I suggest that you open a question on Ask Ubuntu. This bug tracker is simply not the right spot for that. You're welcome to send me a comment with a link to your question and I'll see if I can help.

sergiuszkierat commented 6 years ago

@davidfoerster Thanks for shedding the light on it, thus I am stick with 3.5 version.