J'essaie de lancer matplotlib sur OS X 10.8.4. J'ai installé matplotlib et les dépendances (libping, freetype, numpy, scipy). Je suis capable d'importer matplotlib très bien. Cependant, si j'essaie d'importer matplotlib.pyplot, il se bloque. Il n'y a pas d'erreur, c'est juste que rien ne se passe.
>>> import matplotlib.pyplot
... J'ai attendu peut-être 20 minutes et rien ne se passe. J'utilise la version 1.2.1, mais j'ai même désinstallé cette version et essayé la version 1.2.0, mais en vain. J'ai vu un certain nombre de questions sur SO à propos des erreurs d'importation avec matplotlib.pyplot, mais rien ne s'y accroche. J'ai ensuite essayé de le faire fonctionner avec la distribution python Enthought/Canopy, mais là encore, le même problème persiste. Voici ce que je vois si je tue l'importation:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/pyplot.py", line 26, in <module>
from matplotlib.figure import Figure, figaspect
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/figure.py", line 34, in <module>
import matplotlib.colorbar as cbar
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/colorbar.py", line 29, in <module>
import matplotlib.collections as collections
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/collections.py", line 23, in <module>
import matplotlib.backend_bases as backend_bases
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 37, in <module>
import matplotlib.widgets as widgets
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/widgets.py", line 17, in <module>
from lines import Line2D
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/lines.py", line 25, in <module>
from matplotlib.font_manager import FontProperties
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1335, in <module>
_rebuild()
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1322, in _rebuild
fontManager = FontManager()
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/font_manager.py", line 980, in __init__
self.ttffiles = findSystemFonts(paths) + findSystemFonts()
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/font_manager.py", line 317, in findSystemFonts
for f in get_fontconfig_fonts(fontext):
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/matplotlib/font_manager.py", line 274, in get_fontconfig_fonts
output = pipe.communicate()[0]
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/subprocess.py", line 746, in communicate
stdout = _eintr_retry_call(self.stdout.read)
File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/subprocess.py", line 478, in _eintr_retry_call
return func(*args)
KeyboardInterrupt
La sortie était la même lorsque j'utilisais le python 2.7 par défaut fourni avec OS X.
Permettre à import matplotlib.pyplot
de s'exécuter pendant quelques heures puis d'interrompre l'importation me donne maintenant le résultat suivant:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matplotlib/pyplot.py", line 26, in <module>
from matplotlib.figure import Figure, figaspect
File "/Library/Python/2.7/site-packages/matplotlib/figure.py", line 34, in <module>
import matplotlib.colorbar as cbar
File "/Library/Python/2.7/site-packages/matplotlib/colorbar.py", line 29, in <module>
import matplotlib.collections as collections
File "/Library/Python/2.7/site-packages/matplotlib/collections.py", line 23, in <module>
import matplotlib.backend_bases as backend_bases
File "/Library/Python/2.7/site-packages/matplotlib/backend_bases.py", line 37, in <module>
import matplotlib.widgets as widgets
File "/Library/Python/2.7/site-packages/matplotlib/widgets.py", line 17, in <module>
from lines import Line2D
File "/Library/Python/2.7/site-packages/matplotlib/lines.py", line 25, in <module>
from matplotlib.font_manager import FontProperties
File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 1335, in <module>
_rebuild()
File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 1322, in _rebuild
fontManager = FontManager()
File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 980, in __init__
self.ttffiles = findSystemFonts(paths) + findSystemFonts()
File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 324, in findSystemFonts
files = list_fonts(path, fontexts)
File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 171, in list_fonts
return cbook.listFiles(directory, pattern)
File "/Library/Python/2.7/site-packages/matplotlib/cbook.py", line 944, in listFiles
for dirname, dirs, files in os.walk(root):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 284, in walk
if isdir(join(top, name)):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.py", line 41, in isdir
st = os.stat(s)
KeyboardInterrupt
Est-ce que quelqu'un sait ce que le for x in walk(new_path, topdown, onerror, followlinks):
récursif pourrait indiquer?
Vous pouvez résoudre le problème sur Mac OS X Mavericks et Yosemite en procédant comme suit:
cd ~/.matplotlib/
fc-list # Should take a couple minutes.
Une fois que fc-list
est terminé, vous pourrez importer le package à l'aide de import matplotlib.pyplot as plt
. C'est le problème de github avec la solution. Il semble que le bogue soit lié au cache de polices.
J'ai compris ce qui se passait. Espérons que la solution est utile aux autres. Dans le dossier /usr/X11/lib
, il y avait un lien symbolique pour le répertoire qui renvoyait à lui-même. Cela semble avoir créé une boucle infinie. Lorsque j'ai supprimé le lien, l'importation a fonctionné.
J'avais le même problème sous Linux.
Il s'est avéré que matplotlib rencontrait quelques problèmes pour comprendre le back-end d'interface graphique à utiliser.
Le fait de dire explicitement d'utiliser l'arrière-plan Tkinter - ce qu'il fait par défaut, à l'aide de la commande suivante, a résolu le problème:
%matplotlib tk
Cette suivie par l'importation
import matplotlib.pyplot as plt
travaillé comme prévu.