Skip to content

Can't not refresh new font in running interpreter #16581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eromoe opened this issue Feb 27, 2020 · 5 comments · Fixed by #21278
Closed

Can't not refresh new font in running interpreter #16581

eromoe opened this issue Feb 27, 2020 · 5 comments · Fixed by #21278

Comments

@eromoe
Copy link

eromoe commented Feb 27, 2020

Bug report

Bug summary

  1. sudo apt-get install fonts-wqy-microhei
  2. can not refresh or get new font in running interpreter/notebook
    image

But it can read new font in new notebook

image

Matplotlib version

  • Operating system: ubuntu
  • Matplotlib version: 3.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7
  • Jupyter version (if applicable):
jupyter core     : 4.6.1
jupyter-notebook : 6.0.2
qtconsole        : not installed
ipython          : 7.11.1
ipykernel        : 5.1.3
jupyter client   : 5.3.4
jupyter lab      : not installed
nbconvert        : 5.6.1
ipywidgets       : not installed
nbformat         : 5.0.3
traitlets        : 4.3.3
@timhoffm
Copy link
Member

timhoffm commented Mar 1, 2020

Maybe related to #13852 .

@tacaswell
Copy link
Member

Likely. It could also be that we have at least one level of caching that is not being properly cleared.

@tacaswell tacaswell added this to the v3.3.0 milestone Mar 1, 2020
@anntzer
Copy link
Contributor

anntzer commented Mar 1, 2020

Regardless of #13582, _rebuild is private API so we don't really support that use case (and I'm not sure it's worth adding public API for hot-regen of the font cache...).
Hence, tempted to close as wontfix.

@eromoe
Copy link
Author

eromoe commented Mar 2, 2020

I have a lot spark result in this notebook,
restart it would need either :

  • save all relate result into hdfs/local , reread them after restart
  • calculate all result again .

Each cost much . So I hope this can be solved in case of similar situation .

In addition, I would appreciate if matplotlib can bundle with CJK font (Or maybe an all-in-one font) . I need install the font in every notebook machine ... Why not just a pip install ? This is the source of many many font problems, i guess there are many CJK font related issue were/would be opened at here) , simply bundle an all-in-one font can finish them. Reduce user's works and contributor's works , isn't it a happy thing ?

@tacaswell
Copy link
Member

@eromoe Could you look into why the we do not support hot-reloading of the font cache? I agree with @anntzer that this is an edge case (and while I understand how it is frustrating for you, the simplest "fix"is to make sure you have a CJK font on your machines before you start the notebook), but it is an edge case that matters to you and we would be happy to review a PR to implement it.

I am not aware of a single font that has all of the glyphs for all unicode points. If there were such a font, I would expect it to be prohibitively large. While I do see why pip-installing fonts would be convenient, it is a bit out of scope for pip.

Matplotlib will find fonts in various user-controlled spaces (

MSUserFontDirectories = [
str(Path.home() / 'AppData/Local/Microsoft/Windows/Fonts'),
str(Path.home() / 'AppData/Roaming/Microsoft/Windows/Fonts'),
]
X11FontDirectories = [
# an old standard installation point
"/usr/X11R6/lib/X11/fonts/TTF/",
"/usr/X11/lib/X11/fonts",
# here is the new standard location for fonts
"/usr/share/fonts/",
# documented as a good place to install new fonts
"/usr/local/share/fonts/",
# common application, not really useful
"/usr/lib/openoffice/share/fonts/truetype/",
# user fonts
str(Path(os.environ.get('XDG_DATA_HOME',
Path.home() / ".local/share")) / "fonts"),
str(Path.home() / ".fonts"),
]
OSXFontDirectories = [
"/Library/Fonts/",
"/Network/Library/Fonts/",
"/System/Library/Fonts/",
# fonts installed via MacPorts
"/opt/local/share/fonts",
# user fonts
str(Path.home() / "Library/Fonts"),
]
) . I assume you have some sort of shared drive between your machines (to get the notebooks onto them) so you could use that to make sure you always have the fonts you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants