Select to view content in your preferred language

After upgrade to ArcGIS Pro 3.1 Python ImportError: DLL load failed while importing _win32sysloader: The specified module could not be found.

3458
5
Jump to solution
02-24-2023 12:21 PM
ColForbin
Occasional Contributor

I just upgraded from ArcGIS Pro 3.0.3 to 3.1.  Now when I run the following script in a python window:

from arcgis.gis import GIS
portal = "https://arcgis.com"
user = "my user"
password = "my password"
gis = GIS(portal, user, password)

I see these errors on the last line:

Traceback (most recent call last):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\auth\_auth\_winauth.py", line 63, in __init__
self.auth = requests_negotiate_sspi.HttpNegotiateAuth()
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\auth\tools\_lazy.py", line 48, in __getattr__
return getattr(self._load(), attrb)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\auth\tools\_lazy.py", line 44, in _load
self._mod = importlib.import_module(self._module_name)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\requests_negotiate_sspi\__init__.py", line 4, in <module>
from .requests_negotiate_sspi import HttpNegotiateAuth # noqa
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\requests_negotiate_sspi\requests_negotiate_sspi.py", line 10, in <module>
import pywintypes
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\win32\lib\pywintypes.py", line 128, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\win32\lib\pywintypes.py", line 49, in __import_pywin32_system_module__
import _win32sysloader
ImportError: DLL load failed while importing _win32sysloader: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 7, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\__init__.py", line 585, in __init__
raise e
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\__init__.py", line 524, in __init__
self._portal = _portalpy.Portal(
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_portalpy.py", line 205, in __init__
self.con = Connection(
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 344, in __init__
self._create_session()
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 507, in _create_session
self._session = EsriSession(
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\auth\api.py", line 198, in __init__
self.auth = EsriWindowsAuth(referer=referer, verify_cert=verify_cert)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\auth\_auth\_winauth.py", line 95, in __init__
raise Exception(
Exception: NTLM authentication requires requests_negotiate_sspi module.

 

Any ideas?

 

0 Kudos
1 Solution

Accepted Solutions
ColForbin
Occasional Contributor

FYI for anyone that may encounter this issue, I uninstalled Pro, and downloaded the 3.1 install file from MyEsri and installed from that.  After that I still had this error, so I ran pip uninstall pywin32, then pip install pywin32, and the issue resolved.  I have colleagues that did not have this issue so it may have been something specific with my setup.

View solution in original post

5 Replies
MarcoBoeringa
MVP Regular Contributor

Before the upgrade to Pro 3.1, were you using the default 'arcgispro-py3' Python environment, or a customized clone created with the ArcGIS Pro "Package Manager"?

If the latter, I guess you may need to update the cloned Python environment for the latest version. Pro will even automatically switch to the default 'arcgispro-py3' environment, if the clone is not up-to-date, and display a warning, so you may be missing vital packages now that you installed in the clone. The "Environment Manager" that is part of the "Package Manager" will show this with a special icon next to the environment that offers the option to upgrade the environment, which seemed to work well in my personal case. Only after upgrading, will you be able switch back to your customized cloned environment and activate it for use in your workflow and scripts.

0 Kudos
ColForbin
Occasional Contributor

I was using the default 'arcgispro-py3' Python environment.

0 Kudos
ColForbin
Occasional Contributor

FYI for anyone that may encounter this issue, I uninstalled Pro, and downloaded the 3.1 install file from MyEsri and installed from that.  After that I still had this error, so I ran pip uninstall pywin32, then pip install pywin32, and the issue resolved.  I have colleagues that did not have this issue so it may have been something specific with my setup.

mpboyle
Regular Contributor

Had the same issue ... updated from Pro 2.9.x to 3.1.1 and could not execute any scripts that used the arcgis module.  Uninstalled and reinstalled the pywin32 module and it seems like things are back on track.

Thanks a lot for this!

0 Kudos
mpboyle
Regular Contributor

One thing I have noticed is that is takes much longer to connect to a portal on the machine where we re-installed the pywin32 module.  My normal work machine was silently updated to 3.1.1 with no issues. 

If I do a simple timing of how long it takes to establish a connection, it takes 3 to 4 times longer on the machine where we did the re-install.  I know this is nit-picking over a few seconds, but I'm wondering if there's a reason for this...?

The first screenshot below is for my work machine (slient update, no issues), and the second is for the machine where we re-installed the pywin32 module.  The connection parameters are the same (url, username, password).

mpboyle_0-1684946035159.png

mpboyle_1-1684946092539.png

 

 

0 Kudos