Skip to content

Font manager cannot find installed font #13673

@ErichBSchulz

Description

@ErichBSchulz

Bug report

Bug summary
Font manager cannot find installed font

**Code for rep

import matplotlib as mpl
display(f'Matplotlib version: {mpl.__version__}')
from matplotlib import pyplot as plt
import matplotlib.font_manager as font_manager
from matplotlib.font_manager import _rebuild; _rebuild()
mpl.rcParams['font.sans-serif'] = ['Helvetica']
mpl.rcParams['font.serif'] = ['Helvetica']
import seaborn as sns
import numpy as np
import os
'Matplotlib version: 3.0.3'
from matplotlib import get_cachedir; print(get_cachedir()) 
/home/jovyan/.cache/matplotlib
font_manager.X11FontDirectories
['/usr/X11R6/lib/X11/fonts/TTF/',
 '/usr/X11/lib/X11/fonts',
 '/usr/share/fonts/',
 '/usr/local/share/fonts/',
 '/usr/lib/openoffice/share/fonts/truetype/',
 '/home/jovyan/.fonts']
sf = font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
display(sf)
['/usr/share/fonts/truetype/liberation/LiberationMono-Italic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSerif-Italic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationMono-BoldItalic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSansNarrow-Regular.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf',
 '/home/jovyan/.fonts/Helvetica.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSansNarrow-Italic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSansNarrow-BoldItalic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSans-BoldItalic.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSansNarrow-Bold.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf',
 '/usr/share/fonts/truetype/liberation/LiberationSerif-BoldItalic.ttf']
fm = font_manager.json_load(os.path.expanduser("~/.cache/matplotlib/fontlist-v300.json"))
fm.findfont("Helvetica", rebuild_if_missing=True)
/opt/conda/lib/python3.6/site-packages/matplotlib/font_manager.py:1241: UserWarning: findfont: Font family ['Helvetica'] not found. Falling back to DejaVu Sans.
  (prop.get_family(), self.defaultFamily[fontext]))





'/opt/conda/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf'
iris = sns.load_dataset("iris")
g = sns.jointplot("sepal_width", "petal_length", data=iris,
       kind="kde", space=0, color="g").set_axis_labels("GaK x", "y")
/opt/conda/lib/python3.6/site-packages/matplotlib/font_manager.py:1241: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
  (prop.get_family(), self.defaultFamily[fontext]))

Expected outcome

Matplotlib version

  • Operating system:
  • Matplotlib version:
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

I'm running jupyter in a docker container

As part of my trial and errors I have repeatedly:

rm -rf ~/.cache/matplotlib/

And I have also:

conda update matplotlib

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy