Issue29307
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017-01-18 10:56 by jeroen-vangoey, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (5) | |||
---|---|---|---|
msg285716 - (view) | Author: Jeroen Van Goey (jeroen-vangoey) * | Date: 2017-01-18 10:56 | |
I installed Python 3.6 from J Fernyhough's PPA by doing sudo add-apt-repository ppa:jonathonf/python-3.6 sudo apt-get update sudo apt-get install python3.6 I made a string, using the new literal string interpolation, but I supplied an invalid format specifier. I not only got the expected "ValueError: Invalid format specifier", but also the unexpected "ModuleNotFoundError: No module named 'apt_pkg'". $ python3.6 Python 3.6.0 (default, Dec 29 2016, 21:40:36) [GCC 5.4.1 20161202] on linux Type "help", "copyright", "credits" or "license" for more information. >>> value = 4 * 20 >>> f'the value is {value:%A}' Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Invalid format specifier Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module> import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module> from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module> import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module> import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Invalid format specifier |
|||
msg285719 - (view) | Author: Xiang Zhang (xiang.zhang) * | Date: 2017-01-18 11:25 | |
It seems to be vendor's issue not CPython itself. This same issue also happens in Ubuntu 16.10's Python 3.6. Raise any exception can cause this: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) [GCC 6.2.0 20161005] on linux Type "help", "copyright", "credits" or "license" for more information. >>> raise Exception Traceback (most recent call last): File "<stdin>", line 1, in <module> Exception Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module> import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module> from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module> import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module> import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "<stdin>", line 1, in <module> Exception >>> Also see https://bugs.launchpad.net/ubuntu/+source/python3.6/+bug/1631367. |
|||
msg285725 - (view) | Author: R. David Murray (r.david.murray) * | Date: 2017-01-18 13:00 | |
Yes, this appears to be the vendor's failure reporting infrastructure that is failing. Why they'd want a report for every traceback at the interactive prompt is beyond me, but that appears to be what they are trying to do. |
|||
msg285730 - (view) | Author: Barry A. Warsaw (barry) * | Date: 2017-01-18 14:41 | |
On Jan 18, 2017, at 10:56 AM, Jeroen Van Goey wrote: >sudo add-apt-repository ppa:jonathonf/python-3.6 >sudo apt-get update >sudo apt-get install python3.6 > >I made a string, using the new literal string interpolation, but I supplied >an invalid format specifier. I not only got the expected "ValueError: Invalid >format specifier", but also the unexpected "ModuleNotFoundError: No module >named 'apt_pkg'". Please understand that installing Python 3.6 from a random PPA does *not* provide full support for this version of the interpreter. Python 3.6 is not yet a supported version in any version of Ubuntu (which I'm assuming your using), although we are working on it for 17.04. Very often, you can install a new Python 3 interpreter package and many things will work because the Ubuntu infrastructure shares pure-Python modules across all installed Python 3's. Technically speaking, they will all have /usr/lib/python3/dist-packages on their sys.path so any third party pure-Python module built for a support version of Python 3 will be importable by any (package-built) installed version of Python 3. But that 1) is a long way from saying that those third-party modules will work; 2) does *not* include any packages containing C extension modules, which must be rebuilt for the specific interpreter version. Supporting a new version of Python is a long process, for which we are just starting. Please engage with ubuntu-devel@ubuntu.com for details. Ubuntu does install a standard exception handler so that when Python applications and such crash, we can gather crash statistics, so that we can devote resources to fixing common problems and regressions. apport (which you see in the traceback) is that crash reporting infrastructure. apport calls apt_pkg, which is an (C++) extension module and thus won't have been built for the version of Python 3.6 you installed from that PPA, unless of course the PPA owner (who I don't know) has also done an archive-wide Python 3 rebuild. Since I'm in the process of setting that up, and I know it's quite a bit of work, I doubt that's been done for this rather random PPA. The ubuntu-devel mailing list is a better place to discuss the ongoing work to bring Python 3.6 as a supported version on Ubuntu. |
|||
msg285733 - (view) | Author: Jeroen Van Goey (jeroen-vangoey) * | Date: 2017-01-18 15:01 | |
Thanks Barry for your extensive explanation! |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:42 | admin | set | github: 73493 |
2017-01-18 15:01:34 | jeroen-vangoey | set | messages: + msg285733 |
2017-01-18 14:41:50 | barry | set | nosy:
+ barry messages: + msg285730 |
2017-01-18 13:00:54 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg285725 resolution: third party stage: resolved |
2017-01-18 11:25:50 | xiang.zhang | set | nosy:
+ xiang.zhang, doko messages: + msg285719 |
2017-01-18 10:56:23 | jeroen-vangoey | create |