Root cause analysis and Woraround for "Error: AttributeError: type object 'Retry' has no attribute 'DEFAULT_METHOD_WHITELIST'"
---------------------------------------------
Problem
- When using databricks-cli, starting with 4th of May this error occurs:
- Error: AttributeError: type object 'Retry' has no attribute 'DEFAULT_METHOD_WHITELIST'
- databricks-cli exits and returns an error
---------------------------------------------
Root cause analysis
databricks-cli depends on requests>=2.17.3
requests depends on urllib3<1.27,>=1.21.1
Collecting urllib3<3,>=1.21.1 (from requests>=2.17.3->databricks-cli)
Downloading urllib3-2.0.2-py3-none-any.whl (123 kB)
Before 4th of May 2023:
Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
-> There is a new(er) release of urllib3
In urllib3 - 2.0.0 (2023-04-26) we can see:
"...Removed deprecated Retry options method_whitelist, DEFAULT_REDIRECT_HEADERS_BLACKLIST (#2086)..."
And this is causing the error Error: AttributeError: type object 'Retry' has no attribute 'DEFAULT_METHOD_WHITELIST'
---------------------------------------------
Workarounds
Two possible workarounds available until now found:
- No. 1
- add urllib3==1.26.15 to requirements.txt
- No. 2
pip install -U databricks-cli
pip uninstall -y urllib3
pip install urllib3==1.26.15
---------------------------------------------