I built a Docker container to run one of our ArcGIS Python API scripts. It ran for a couple of months successfully. Recently I added some minor enhancements and rebuilt the Docker image. Thereafter, the ArcGIS API quit working properly when run in the Docker container. I decided to reduce the script down to this and it still throws an error (see below). This is the script:
from arcgis.gis import GIS
gis = GIS(settings['myurl'], settings['myusername'], settings['mypassword'],verify_cert=False)
This is the error message:
sh-4.4# python3.9 test.py Traceback (most recent call last): File "/app/test.py", line 2, in gis = GIS('https://**','','****') File "/usr/local/lib/python3.9/site-packages/arcgis/gis/init.py", line 585, in init raise e File "/usr/local/lib/python3.9/site-packages/arcgis/gis/init.py", line 524, in init self._portal = _portalpy.Portal( File "/usr/local/lib/python3.9/site-packages/arcgis/gis/_impl/_portalpy.py", line 205, in init self.con = Connection( File "/usr/local/lib/python3.9/site-packages/arcgis/gis/_impl/_con/_connection.py", line 344, in init self._create_session() File "/usr/local/lib/python3.9/site-packages/arcgis/gis/_impl/_con/_connection.py", line 521, in _create_session max_retries=Retry( TypeError: init() got an unexpected keyword argument 'method_whitelist'
This is the Docker file:
FROM [my org]/cloud/ubi/python:3.9
WORKDIR /app
COPY . .
RUN yum install -y krb5-libs krb5-workstation krb5-devel gcc
RUN pip3.9 install -r ./src/requirements.txt
RUN chmod 744 ./src/everyminute_run.sh
RUN chmod 744 ./src/everyhour_run.sh
RUN chmod 744 ./src/everynight_run.sh
This is the requirements.txt
psycopg2-binary
oracledb
arcgis
Note: I tried the current and the previous versions of the ArcGIS library and they both produced the same error message.
1 Answer 1
I had the same issue. I was able to solve it by downgrading the Python library 'urllib3' back to 1.26.14 in my requirements.txt file.
ie. urllib3==1.26.14