Select to view content in your preferred language

Can't import pyplot

1240
3
07-11-2012 08:35 AM
StephenFricke
New Contributor III
I am trying to use matplotlib within my script to create some graphs of some data.  When I try and import pyplot through matplotlib I get the following error....

Traceback (most recent call last):
  File "C:\reacch\problems\pyplot.py", line 2, in <module>
    from matplotlib import pyplot as plt
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\pyplot.py", line 23, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\figure.py", line 18, in <module>
    from axes import Axes, SubplotBase, subplot_class_factory
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\axes.py", line 14, in <module>
    import matplotlib.axis as maxis
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\axis.py", line 14, in <module>
    import matplotlib.text as mtext
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\text.py", line 31, in <module>
    from matplotlib.backend_bases import RendererBase
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\backend_bases.py", line 48, in <module>
    import matplotlib.textpath as textpath
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\textpath.py", line 9, in <module>
    from matplotlib.mathtext import MathTextParser
  File "C:\Python27\ArcGIS10.1\lib\site-packages\matplotlib\mathtext.py", line 28, in <module>
    import unicodedata
ImportError: DLL load failed: The specified procedure could not be found.


When I try to import pyplot from matplotlib outside of ArcGIS inside the IDLE window everything works fine.  This seems odd to me considering the site packages for matplotlib are the exact same for running the script both in and outside of ArcGIS.  Does anyone know what may be the issue?  Thanks!
Tags (2)
0 Kudos
3 Replies
JasonScheirer
Regular Contributor II
A common issue I see is that the PYDs are compiled with a manifest and expect a certain version of the Visual Studio C Runtime (MSVC*.dll) to be loaded in memory, and a different version is loaded in ArcMap.exe so it fails to load. The workaround is to find a build without a manifest in the PYD or rebuild the library yourself doing the same.
0 Kudos
StephenFricke
New Contributor III
Hey thanks for the response.  I am sorry I am not very well versed in tech lingo.  I think the problem might have originally occurred when I added a bunch of enthought python modules to the c:/python27/ArcGIS10.1/Lib/Site-Packages directory.  All of the modules that I have tried which I added to this directory seem to work fine.  Importing matplotlib works fine as well but as soon as I try and import pyplot from matplotlib I get this huge error message.  Did I mess up the wiring for the matplotlib within ArcGIS when I added other modules from enthought to the ArcGIS site-packages directory?  Thank you!
0 Kudos
JasonScheirer
Regular Contributor II
I don't think they're messed up per se, I just think they might be incompatible, period. You may need to reinstall.

Try gettig the libraries you want from this site instead. (http://www.lfd.uci.edu/~gohlke/pythonlibs/)
0 Kudos