Bug 1449006 - Pygments can't output images due to missing Bitstream fonts
Summary: Pygments can't output images due to missing Bitstream fonts
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pygments
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Steve Milner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-09 04:06 UTC by Hugo
Modified: 2017-12-12 10:58 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-12-12 10:58:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hugo 2017-05-09 04:06:32 UTC
Description of problem:
-----------------------

If I try to create an image file with Pygments I get an error complaining that I need to install the Bitstream Vera Sans Mono font.


Version-Release number of selected component (if applicable):
-------------------------------------------------------------

python3-pygments is version 2.2.0


How reproducible:
-----------------

Every time, if your system doesn't have the Bitstream Vera Sans Mono font already installed.


Steps to Reproduce:
-------------------

1. Create a text file with some source code (say, "test.c")
2. Run `pygmentize -o test.png test.c`


Actual results:
---------------

The following error message shows up:


*** Error while highlighting:
pygments.formatters.img.FontNotFound: No usable fonts named: "Bitstream Vera Sans Mono"
   (file "/usr/lib/python3.5/site-packages/pygments/formatters/img.py", line 107, in _create_nix)
*** If this is a bug you want to report, please rerun with -v.


Running with the `-v` flag shows a more verbose stacktrace:

*****************************************************************
An unhandled exception occurred while highlighting.
Please report the whole traceback to the issue tracker at
<https://bitbucket.org/birkenfeld/pygments-main/issues>.
*****************************************************************

Traceback (most recent call last):
  File "/usr/bin/pygmentize", line 9, in <module>
    load_entry_point('Pygments==2.2.0', 'console_scripts', 'pygmentize')()
  File "/usr/lib/python3.5/site-packages/pygments/cmdline.py", line 543, in main
    return main_inner(popts, args, usage)
  File "/usr/lib/python3.5/site-packages/pygments/cmdline.py", line 452, in main_inner
    fmter = get_formatter_for_filename(outfn, **parsed_opts)
  File "/usr/lib/python3.5/site-packages/pygments/formatters/__init__.py", line 128, in get_formatter_for_filename
    return _formatter_cache[name](**options)
  File "/usr/lib/python3.5/site-packages/pygments/formatters/img.py", line 353, in __init__
    self.fonts = FontManager(options.get('font_name', ''), fontsize)
  File "/usr/lib/python3.5/site-packages/pygments/formatters/img.py", line 83, in __init__
    self._create_nix()
  File "/usr/lib/python3.5/site-packages/pygments/formatters/img.py", line 107, in _create_nix
    self.font_name)
pygments.formatters.img.FontNotFound: No usable fonts named: "Bitstream Vera Sans Mono"



Expected results:
------------------

It should create a "test.png" image without complaining about anything.


Additional info:
----------------

I could fix the problem by installing the "bitstream-vera-sans-mono-fonts" package. Perhaps it should be listed as a required dependency for pygments?

Comment 1 Orion Poplawski 2017-05-09 13:46:17 UTC
I know it's confusing, but python3-pygments is for EPEL (though it probably suffers the same issue).

Comment 2 Hugo 2017-05-10 03:19:02 UTC
The reason I was using python3-pygments is because python-pygments didn't install the pygmentize executable. `rpm -ql python2-pygments | grep pygmentize` and `rpm -ql python2-pygments | grep bin` both come out empty.

Is this unintentional? If so, should I file an additional bug?

---------

BTW, I forgot to mention that the error message abouot the missing font also happened when I installed Pygments with `pip install`.

Comment 3 Orion Poplawski 2017-05-10 03:26:17 UTC
Right, but the "python3-pygments" "binary" rpm package is generated from the "python-pygments" source rpm package in Fedora - and bugzilla reports are for source packages, not "binary" rpms.  See "rpm -qi python3-pygments" for the Source package name.  Meanwhile in EPEL, which shares a package namespace with Fedora, the python34-pygments binary rpm is generated from the python3-pygments source package.  As I mentioned, confusing.

Since we're moving to python3 as a "default" of sorts - the executables are the python3 versions.  So this is intentional.

Finally, don't use 'pip install' as root as this will overwrite system packages and surely cause problems.

Comment 4 Hugo 2017-05-10 03:42:32 UTC
Ah, thanks for clearing that up. It is indeed very confusing :)

I think the part that tripped me is that if I do a `dnf install python-pygments`  will install the relatively useless `python2-pygments` instead of installing `python3-pygments`. Shouldn't it be the other way around if the python3 is the "default of  sorts"?

Comment 5 Fedora End Of Life 2017-11-16 19:07:50 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2017-12-12 10:58:24 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.