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
Repeated warning about fc-list #5836
Comments
The only change in 1.5.1 is the addition of the warning in #5640 so there should be no performance difference. It's called twice to find both Internally matplotlib pickles the fontmanager and only ever runs this code if there is no font cache installed so this should not be seen on other than the first import of pyplot. The warning was added because that call may be really slow on a system with many fonts installed see #5640 In the long term there are plans to significantly rewrite the font handling see notes in #5414 |
This warning is triggering |
Hmmm... That's an interesting outcome of all this. We could suppress the warning if |
I was always ambivalent to it and would be fine with removing it again. The strongest argument in favor of it is users having short attention spans which I do not really find persuasive.
|
What about just changing it to a print? The main point is to provide interactive feedback to users when importing pyplot that would be lost if we used logging. |
On our travis tests we get the message at each build. On which kind of architecture will the cache take so long that it requires a message? |
The problem with "print" is that that can't be filtered at all. A warning As for what kinds of systems this can take so long, basically any system On Fri, Jan 15, 2016 at 6:00 AM, Fabien Maussion notifications@github.com
|
A somewhat crazy idea, but what about emitting the warning only if the process takes more than a certain time? For example: import time
import warnings
import subprocess
import multiprocessing as mp
def delayed_warning():
time.sleep(5)
warnings.warn('Matplotlib is building the font cache using fc-list. '
'This may take a moment.')
proc = mp.Process(target=delayed_warning)
proc.start()
subprocess.call('fc-list')
proc.terminate() |
Not a crazy idea, if it's robust enough. Note that all of this will be wasted effort following #5414, where we just call the font-config API directly and don't have to copy all of its contents into our own cache. |
not the prettiest work around, but i silenced the warnings for the time being (although the small startup delay is still present) with the following code, maybe a better filter could be used to allow other warnings
|
@derekneil try removing everything the mpl cache, you should only have seen this once on the first import.... |
@tacaswell i did try removing everything in the cache, but it happens every time on my system for some reason |
I ran the python code w. sudo and it cured it...my guess was that there wasn't permission to write that table... good luck! |
@catubc You should sort out what file you do not have permission to write as a user and fix the permissions on that file. Running python with |
I got this issue after upgrading matplotlib and clearing the cache solved my issue! |
@derekneil @fmder +1 "rm -rf ~/.matplotlib" solved the problem for me too |
For me it was |
|
|
|
matplotlib/matplotlib#5836 guidance from WeatherGod
I strongly agree with @astrofrog about this. This is broken behavior, as far as I'm concerned. Warnings should be reserved for things that are either likely to be user error or where the code's behavior is probably not what the user is expecting. And in the latter case, there should be an easy way to suppress the warning if it really is what the user meant. e.g. The warning emitted by The warning about fc-list, OTOH, is not actionable. And in many cases (e.g. imports by dependencies) it is not suppressible. And with the rising popularity of Travis CI (and others), we get a clean system each time, so people are seeing it a lot. It adds quite a lot of noise to our test output, especially with the warning being emitted multiple times, not just once as it should. For my case, none of the above suggestions for Travis have worked. My solution has been to use FWIW, I thought the suggestion by @astrofrog to only emit the warning if building the cache takes more than 5 seconds or so was a good one. This would solve most of the cases where this behavior is seen as a bug and preserve the cases where people find it useful. And figuring out why it is emitting the warning multiple times and fixing that would be nice as well. |
I agree; we need to figure out a better way to handle this. Also, as @astrofrog noted originally, the warning is emitted twice, which in itself indicates there is a real bug in the code. |
Not a bug, but an inefficiency:
|
Being emitted twice is correct behavior as we are looking for two types of fonts, maybe that should be included in the warning.
@rmjarvis I find it difficult to take this sort of over-the-top rhetoric seriously. Almost all of the CI services let you keep a persistent cache between runs, push mpl sits at a weird edge between a library and a user interface. Providing some sort of feedback to users who hit surprisingly long import times (my understanding is that if you have all the adobe fonts installed this can take minutes) is important. The problem with moving to a If there is a non-thread based way to get a 5s delay I am 👍 on that, but bringing threads in this seems like complexity overkill. I think this should be closed again. |
On 2016/11/29 4:53 AM, Thomas A Caswell wrote:
Being emitted twice is correct behavior as we are looking for two types
of fonts, maybe that should be included in the warning.
I don't agree. First, even though we are looking for two types of
fonts, this does not require running fc-list twice, because as far as I
can see the calls are identical, returning the same list. Second,
because this is a very unusual warning in that it is just telling the
user to be patient. There is no benefit at all in sending that message
twice.
|
@tacaswell @efiring - see #7532 |
This is annoying, but not release critical. Bumping this to 2.0.1, as we almost have a patch ready for that one (so it'll probably go in for 2.0). |
Closed by #7596. |
For those arriving after experiencing this problem with docker specifically, I added the below to my Dockerfile:
That way it will create the cache when you first build the image, but then should not warn anymore on subsequent runs. |
|
It also seems this could be moved from |
1.5.1-1.5.3 hang on Travis CI . see matplotlib/matplotlib#5836
Since Matplotlib 1.5.1, I see a warning (twice) each time I instantiate a
FontManager()
:This did not happen with 1.5.0. There's two issues here - the warning is repeated twice at each call, which indicates that the command is being run twice (inefficient), and the warning is being shown at all - why does
fc-list
need to be run every timeFontManager
is run? Even if there is a good reason for it to run, I'm not sure if a warning is necessary?The text was updated successfully, but these errors were encountered: