Select to view content in your preferred language

ArcGIS Package urllib3 library issue

2601
4
05-05-2023 06:46 AM
jvarasanz
Regular Contributor

I'm recently experiencing issues with the ARCGIS package installed with my azure function. The urllib3 library was updated to version 2.0.2 in May 3 and, since then, the code is unable to log into arcgis using arcgis for python due to the following error:

init() got an unexpected keyword argument 'method_whitelist'

I'm not sure if there is a way to overwrite the library to the last working version (1.26.15), since it is actually installed with the arcgis package itself.

Any guidance will be highly appreciated.

4 Replies
RogerAsbury
Frequent Contributor

Just popping in to say I am getting this error as well on a new Azure function app I am working on. The specific error I am seeing is below:

System.Private.CoreLib: Exception while executing function: Functions.getPercentages. System.Private.CoreLib: Result: Failure
Exception: TypeError: __init__() got an unexpected keyword argument 'method_whitelist'
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 407, in _handle__invocation_request
call_result = await self._loop.run_in_executor(
File "C:\Python39\lib\concurrent\futures\thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 649, in _run_sync_func
return ExtensionManager.get_sync_invocation_wrapper(context,
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\extension.py", line 215, in _raw_invocation_wrapper
result = function(**args)
File "*****\getPercentages\__init__.py", line 34, in main
gis = GIS(url, user, pw)
File "*****\.venv\lib\site-packages\arcgis\gis\__init__.py", line 586, in __init__
raise e
File "*****\.venv\lib\site-packages\arcgis\gis\__init__.py", line 525, in __init__
self._portal = _portalpy.Portal(
File "*****\.venv\lib\site-packages\arcgis\gis\_impl\_portalpy.py", line 208, in __init__
self.con = Connection(
File "*****\.venv\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 353, in __init__
self._create_session()
File "*****\.venv\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 526, in _create_session
max_retries=Retry(

--
Roger Asbury
Analyst/Programmer - Fairbanks North Star Borough
0 Kudos
jvarasanz
Regular Contributor

Just in case it works for you too, try adding urllib3==1.26.15 at the end of your requirements. Hopefully the issue with the current library can be fixed to avoid this.

jvarasanz
Regular Contributor

The following feedback from the Microsoft Support Team confirms the issue:

Thanks for reaching out. It looks like you are experiencing issues with the ArcGIS package installed in your Azure Function due to a recent update to the urllib3 library which is the last version that may not be compatible with the arcgis package.

One possible solution is to pin the version of urllib3 to the last working version (1.26.5) in your Azure Function. You can do this by adding the following line to your requirements.txt file:

Copy
 
urllib3==1.26.5

This will ensure that the version of urllib3 used in your Azure Function is the last working version.

InfodimGIS
Occasional Contributor

I would just like to confirm that both older urllib3 versions (1.26.5 and 1.26.15) that are mentioned here, solved the issue for us. Currently sticking to 1.26.15. Thanks a lot for the info.