Description of problem: sympy.preview('x**2') results in: ModuleNotFoundError: No module named 'pyglet.image.codecs.png' I guess it is caused by explicitly removing the png codec from the python-pyglet package: https://src.fedoraproject.org/rpms/python-pyglet/blob/master/f/python-pyglet.spec#_96
First of all, there might be some latex dependency missing? >>> import sympy >>> sympy.preview('x**2') Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/sympy/printing/preview.py", line 252, in preview _check_output_no_window( File "/usr/lib/python3.9/site-packages/sympy/printing/preview.py", line 27, in _check_output_no_window return check_output(*args, creationflags=creation_flag, **kwargs) File "/usr/lib64/python3.9/subprocess.py", line 420, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib64/python3.9/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['latex', '-halt-on-error', '-interaction=nonstopmode', 'texput.tex']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.9/site-packages/sympy/printing/preview.py", line 258, in preview raise RuntimeError( RuntimeError: 'latex' exited abnormally with the following output: b"This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=latex)\n restricted \\write18 enabled.\nentering extended mode\n(./texput.tex\nLaTeX2e <2020-02-02> patch level 5\nL3 programming layer <2020-04-06>\n\n! LaTeX Error: File `standalone.cls' not found.\n\nType X to quit or <RETURN> to proceed,\nor enter new name. (Default extension: cls)\n\nEnter file name: \n! Emergency stop.\n<read *> \n \nl.2 ^^M\n \nNo pages of output.\nTranscript written on texput.log.\n" After $ dnf install 'tex(standalone.cls)' 'tex(euler.sty)' I can reproduce the problem: $ python3 -c 'import sympy; sympy.preview("x**2")' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.9/site-packages/sympy/printing/preview.py", line 328, in preview return _run_pyglet(join(workdir, src), fmt=output) File "/usr/lib/python3.9/site-packages/sympy/printing/preview.py", line 35, in _run_pyglet from pyglet.image.codecs.png import PNGImageDecoder ModuleNotFoundError: No module named 'pyglet.image.codecs.png' When I hot-patch /usr/lib/python3.9/site-packages/sympy/printing/preview.py to use `from pyglet.image.codecs.pil import PILImageDecoder`, it works.
Miro, thank you once again! If we're ever in the same place at the same time, I owe you at least one drink. :-)
FEDORA-2020-d312b367e4 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-d312b367e4
FEDORA-2020-d312b367e4 has been pushed to the Fedora 33 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-d312b367e4` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-d312b367e4 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
Indeed, I removed the png codec. Upstream doesn't always install with the more performant PIL, but in Fedora we do. On the other hand, in Fedora there are bundling issues with PyPNG. As the pyglet docs say[0], forcing a specific encoder is "not recommended unless your application has to work around specific deficiences in an operating system decoder." Are there any? [0] https://pyglet.readthedocs.io/en/latest/programming_guide/image.html?highlight=PNGImageDecoder#loading-an-image
No, and thank you for the updated patch. I will contact upstream about making this change.
FEDORA-2020-d312b367e4 has been pushed to the Fedora 33 stable repository. If problem still persists, please make note of it in this bug report.