Recently upgraded to 10.5 ArcGIS. Custom ArcPy Toolbox (pyt) shows the red-x error and will not load. Going to "Check Syntax.." results in this:
File "[from custom ArcPy Tool .py file]"...
import matplotlib.pyplot as plt
File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 129, in <module>
from matplotlib.externals.six.moves.urllib.request import urlopen
File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\externals\six.py", line 90, in __get__
result = self._resolve()
File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\externals\six.py", line 158, in _resolve
module = _import_module(self.mod)
File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\externals\six.py", line 80, in _import_module
__import__(name)
File "C:\Python27\ArcGISx6410.5\Lib\urllib2.py", line 94, in <module>
import httplib
File "C:\Python27\ArcGISx6410.5\Lib\httplib.py", line 72, in <module>
import socket
File "C:\Python27\ArcGISx6410.5\Lib\socket.py", line 47, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
Maybe it's normal, but I do notice the stack trace goes from the 32-bit to 64-bit installs of python. 64-bit should be default I think as I installed background geoprocessing and have it enabled.
Seems to be specific to matplotlib as other custom PYTs load fine, but if I add import matplotlib
they also run into same error. There is a matplotlib in the site-packages for 64-bit python. Just to be safe I upgraded it via pip to the latest.
Everything is version 10.5.1.7333, including Background Geoprocessing (64-bit). I did a repair install of ArcGIS 10.5 and Background Geoprocessing with no effect. All PYTHONPATH environment variables are pointing to 64-bit python.