-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Matplotlib 3.0.0 import hangs in clean environment #12556
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
Labels
Milestone
Comments
Closed
Wasn't there a recent fix that fixed the font search paths? Wasn't it
previously accidentally searching recursively from the current directory?
If so, then that might explain why it could get hung up if a user's file
struture is large and complex.
…On Thu, Oct 18, 2018 at 1:49 PM drdavella ***@***.***> wrote:
Bug report
*Bug summary*
When importing matplotlib.pyplot, the interpreter hangs indefinitely.
This only seems to happen in an environment where $HOME/.matplotlib does
not yet exist. I reproduced this in my environment by renaming the existing
$HOME/.matplotlib directory. Critically, this only seems to occur when
running the script from $HOME.
A valid workaround seems to be to move to any other directory and run the
same command. After this, a new .matplotlib/ directory now exists in $HOME,
and the previous command works fine when running from $HOME.
In order to reproduce this I created a conda environment with the
following command:
$ conda create -n mpl-test python ipython matplotlib
Everything came from the default channel.
*Code for reproduction*
from matplotlib import pytplot as plt
*Actual outcome*
This hangs indefinitely. When I hit CTRL-C, I get something like the
following:
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/pyplot.py in <module>
30 from cycler import cycler
31 import matplotlib
---> 32 import matplotlib.colorbar
33 import matplotlib.image
34 from matplotlib import rcsetup, style
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/colorbar.py in <module>
30 import matplotlib.collections as collections
31 import matplotlib.colors as colors
---> 32 import matplotlib.contour as contour
33 import matplotlib.cm as cm
34 import matplotlib.gridspec as gridspec
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/contour.py in <module>
16 import matplotlib.colors as mcolors
17 import matplotlib.collections as mcoll
---> 18 import matplotlib.font_manager as font_manager
19 import matplotlib.text as text
20 import matplotlib.cbook as cbook
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in <module>
1361 raise
1362 except Exception:
-> 1363 _rebuild()
1364 else:
1365 _rebuild()
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in _rebuild()
1342 global fontManager
1343
-> 1344 fontManager = FontManager()
1345
1346 if _fmcache:
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in __init__(self, size, weight)
976 self.defaultFont = {}
977
--> 978 ttffiles = findSystemFonts(paths) + findSystemFonts()
979 self.defaultFont['ttf'] = next(
980 (fname for fname in ttffiles
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in findSystemFonts(fontpaths, fontext)
268 # check for OS X & load its fonts if present
269 if sys.platform == 'darwin':
--> 270 fontfiles.update(OSXInstalledFonts(fontext=fontext))
271
272 elif isinstance(fontpaths, str):
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in OSXInstalledFonts(directories, fontext)
216 directories = OSXFontDirectories
217 return [path
--> 218 for directory in directories
219 for ext in get_fontext_synonyms(fontext)
220 for path in list_fonts(directory, ext)]
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in <listcomp>(.0)
218 for directory in directories
219 for ext in get_fontext_synonyms(fontext)
--> 220 for path in list_fonts(directory, ext)]
221
222
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in list_fonts(directory, extensions)
155 extensions = ["." + ext for ext in extensions]
156 return [str(path)
--> 157 for path in filter(Path.is_file, Path(directory).glob("**/*.*"))
158 if path.suffix in extensions]
159
~/miniconda3/envs/mpl-test/lib/python3.7/site-packages/matplotlib/font_manager.py in <listcomp>(.0)
154 """
155 extensions = ["." + ext for ext in extensions]
--> 156 return [str(path)
157 for path in filter(Path.is_file, Path(directory).glob("**/*.*"))
158 if path.suffix in extensions]
~/miniconda3/envs/mpl-test/lib/python3.7/pathlib.py in glob(self, pattern)
1080 raise NotImplementedError("Non-relative patterns are unsupported")
1081 selector = _make_selector(tuple(pattern_parts))
-> 1082 for p in selector.select_from(self):
1083 yield p
1084
~/miniconda3/envs/mpl-test/lib/python3.7/pathlib.py in _select_from(self, parent_path, is_dir, exists, scandir)
543 for starting_point in self._iterate_directories(parent_path, is_dir, scandir):
544 for p in successor_select(starting_point, is_dir, exists, scandir):
--> 545 if p not in yielded:
546 yield p
547 yielded.add(p)
~/miniconda3/envs/mpl-test/lib/python3.7/pathlib.py in __hash__(self)
724 return self._hash
725 except AttributeError:
--> 726 self._hash = hash(tuple(self._cparts))
727 return self._hash
728
~/miniconda3/envs/mpl-test/lib/python3.7/pathlib.py in _cparts(self)
710 # Cached casefolded parts, for hashing and comparison
711 try:
--> 712 return self._cached_cparts
713 except AttributeError:
714 self._cached_cparts = self._flavour.casefold_parts(self._parts)
KeyboardInterrupt:
*Expected outcome*
It shouldn't hang! 😝
*Matplotlib version*
- Operating system: OSX 10.12.6 (High Sierra)
- Matplotlib version: 3.0.0
- Matplotlib backend (print(matplotlib.get_backend())): This command
hangs also, but after performing the workaround I get 'TkAgg'
- Python version: 3.7.0, but we initially saw this on 3.6.6.
- Jupyter version (if applicable): N/A
- Other libraries: The only other thing installed in this environment
is IPython
cc @brechmos-stsci <https://github.com/brechmos-stsci> who initially
encountered this issue and discovered the workaround.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#12556>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AARy-Psau2zxpfVneNgarEjbvgSbYy1Zks5umL81gaJpZM4XuCNa>
.
|
Just curious but when will this fix be released? |
Current plan is for the 3.0.1 release to happen first week of november. As a rough estimate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug summary
When importing
matplotlib.pyplot
, the interpreter hangs indefinitely. This only seems to happen in an environment where$HOME/.matplotlib
does not yet exist. I reproduced this in my environment by renaming the existing$HOME/.matplotlib
directory. Critically, this only seems to occur when running the script from$HOME
.A valid workaround seems to be to move to any other directory and run the same command. After this, a new
.matplotlib/
directory now exists in$HOME
, and the previous command works fine when running from$HOME
.In order to reproduce this I created a conda environment with the following command:
$ conda create -n mpl-test python ipython matplotlib
Everything came from the
default
channel.Code for reproduction
Actual outcome
This hangs indefinitely. When I hit
CTRL-C
, I get something like the following:Expected outcome
It shouldn't hang! 😝
Matplotlib version
print(matplotlib.get_backend())
): This command hangs also, but after performing the workaround I get'TkAgg'
cc @brechmos-stsci who initially encountered this issue and discovered the workaround.
The text was updated successfully, but these errors were encountered: