When importing pyplot from matplotlib it freezes

I am trying to import pyplot, but my python code does not start and gets stuck in the following place:

from matplotlib import pyplot as plt

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "matplotlib/pyplot.py", line 24, in <module>
    import matplotlib.colorbar
  File "matplotlib/colorbar.py", line 29, in <module>
    import matplotlib.collections as collections
  File "matplotlib/collections.py", line 23, in <module>
    import matplotlib.backend_bases as backend_bases
  File "matplotlib/backend_bases.py", line 50, in <module>
    import matplotlib.textpath as textpath
  File "matplotlib/textpath.py", line 11, in <module>
    import matplotlib.font_manager as font_manager
  File "matplotlib/font_manager.py", line 1356, in <module>
    _rebuild()
  File "matplotlib/font_manager.py", line 1341, in _rebuild
    fontManager = FontManager()
  File "matplotlib/font_manager.py", line 989, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "matplotlib/font_manager.py", line 318, in findSystemFonts
    for f in get_fontconfig_fonts(fontext):
  File "matplotlib/font_manager.py", line 275, in get_fontconfig_fonts
    output = pipe.communicate()[0]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 791, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)

I tried uninstalling matplotlib using pip so that I can reinstall the package, but also gives a long list of errors. I run this on my Mac OSX 10.11.

+4
source share
1 answer

Better to use Conda. I also had this problem [in windows]. I completely uninstalled and reinstalled python. Then it was perfect. I think this is due to corrupted files. However, I moved to Conda Wednesday. It is smoother and more comfortable.

  • Download Anaconda from the Scipy page
  • Open Conda Command Line
  • Use code: -conda install pymc pymc
  • Conda, Scipy, Pymc, Numpy, matplotlib .
  • matplotlib, pip install matplotlib.

.

, python. pip. .

, .

+2

Source: https://habr.com/ru/post/1606159/


All Articles