ArcGIS Notebook error gis = GIS("home")

658
5
07-17-2023 08:41 AM
Oiligriv
Occasional Contributor

Hello Community
I'm experiencing an anomaly on ArcGIS Notebook Server 11.1.
when I run the first notebook with just the command gis = GIS("home") I get the following error

---------------------------------------------------------------------------
gaierror Traceback (most recent call last)
/opt/conda/lib/python3.9/site-packages/urllib3/connection.py in _new_conn(self)
173 try:
--> 174 conn = connection.create_connection(
175 (self._dns_host, self.port), self.timeout, **extra_kw

/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
71
---> 72 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
73 af, socktype, proto, canonname, sa = res

/opt/conda/lib/python3.9/socket.py in getaddrinfo(host, port, family, type, proto, flags)
953 addrlist = []
--> 954 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
955 af, socktype, proto, canonname, sa = res

gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last)
/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
702 # Make the request on the httplib connection object.
--> 703 httplib_response = self._make_request(
704 conn,

/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
385 try:
--> 386 self._validate_conn(conn)
387 except (SocketTimeout, BaseSSLError) as e:

/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
1041 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
-> 1042 conn.connect()
1043

/opt/conda/lib/python3.9/site-packages/urllib3/connection.py in connect(self)
357 # Add certificate verification
--> 358 self.sock = conn = self._new_conn()
359 hostname = self.host

/opt/conda/lib/python3.9/site-packages/urllib3/connection.py in _new_conn(self)
185 except SocketError as e:
--> 186 raise NewConnectionError(
187 self, "Failed to establish a new connection: %s" % e

NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7ff354714e50>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last)
/opt/conda/lib/python3.9/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
488 if not chunked:
--> 489 resp = conn.urlopen(
490 method=request.method,

/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
814 )
--> 815 return self.urlopen(
816 method,

/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
814 )
--> 815 return self.urlopen(
816 method,

/opt/conda/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
786
--> 787 retries = retries.increment(
788 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]

/opt/conda/lib/python3.9/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
591 if new_retry.is_exhausted():
--> 592 raise MaxRetryError(_pool, url, error or ResponseError(cause))
593

MaxRetryError: HTTPSConnectionPool(host='rfiappgis01wlab.fstech.local', port=7443): Max retries exceeded with url: /arcgis/sharing/rest/portals/self (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff354714e50>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)
/opt/conda/lib/python3.9/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
1469
-> 1470 resp = self._session.post(
1471 url=url,

/opt/conda/lib/python3.9/site-packages/arcgis/auth/api.py in post(self, url, data, json, **kwargs)
487 redirects = self.allow_redirects
--> 488 return self._session.post(
489 url,

/opt/conda/lib/python3.9/site-packages/requests/sessions.py in post(self, url, data, json, **kwargs)
634
--> 635 return self.request("POST", url, data=data, json=json, **kwargs)
636

/opt/conda/lib/python3.9/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
586 send_kwargs.update(settings)
--> 587 resp = self.send(prep, **send_kwargs)
588

/opt/conda/lib/python3.9/site-packages/requests/sessions.py in send(self, request, **kwargs)
700 # Send the request
--> 701 r = adapter.send(request, **kwargs)
702

/opt/conda/lib/python3.9/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
564
--> 565 raise ConnectionError(e, request=request)
566

ConnectionError: HTTPSConnectionPool(host='rfiappgis01wlab.fstech.local', port=7443): Max retries exceeded with url: /arcgis/sharing/rest/portals/self (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff354714e50>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)
/tmp/ipykernel_121/4088297746.py in <cell line: 2>()
1 from arcgis.gis import GIS
----> 2 gis = GIS("home")

/opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
583 )
584 else:
--> 585 raise e
586 try:
587 if (

/opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active, client_id, profile, **kwargs)
522 self._expiration = 60
523 try:
--> 524 self._portal = _portalpy.Portal(
525 self._url,
526 self._username,

/opt/conda/lib/python3.9/site-packages/arcgis/gis/_impl/_portalpy.py in __init__(self, url, username, password, key_file, cert_file, expiration, referer, proxy_host, proxy_port, connection, workdir, tokenurl, verify_cert, client_id, custom_auth, token, **kwargs)
230 )
231 # self.get_version(True)
--> 232 self.get_properties(True)
233
234 def add_group_users(

/opt/conda/lib/python3.9/site-packages/arcgis/gis/_impl/_portalpy.py in get_properties(self, force)
1300 ) # issue seen with key, cert auth
1301 if not resp:
-> 1302 raise e
1303
1304 if resp:

/opt/conda/lib/python3.9/site-packages/arcgis/gis/_impl/_portalpy.py in get_properties(self, force)
1280 resp = None
1281 try:
-> 1282 resp = self.con.post(path, self._postdata(), ssl=True)
1283 except Exception as e:
1284 if (

/opt/conda/lib/python3.9/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
1498 raise requests.exceptions.SSLError("Invalid URL provided: %s" % errIU)
1499 except requests.exceptions.ConnectionError as errCE:
-> 1500 raise requests.exceptions.ConnectionError(
1501 "A connection error has occurred: %s" % errCE
1502 )

ConnectionError: A connection error has occurred: HTTPSConnectionPool(host='rfiappgis01wlab.fstech.local', port=7443): Max retries exceeded with url: /arcgis/sharing/rest/portals/self (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff354714e50>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Notebook Server is installed on Ubuntu 22.04
and the docker is the CE version

  • SSL certificates have been installed
  • the PrivatePortalURL has been enhanced
  • The hosts files are compiled correctly
  • the init_param.sh file has been compiled with Proxy info
  • the /etc/enviroment file is compiled with the proxy info

with the arcgis user in linux if I execute a CURL -K of the private portal url everything works correctly

What could it be?

Thank you

Virgilio

0 Kudos
5 Replies
Oiligriv
Occasional Contributor

I discovered the error.
essentially docker images by default, don't read the server's local Hosts file.

How do you think I can edit the hosts file for Esri's docker images?

Thank you

ChristopherPawlyszyn
Esri Contributor

You should be able to use the dockerExtraHosts system property configured via Notebook Server Admin, check out the API documentation here.


-- Chris Pawlyszyn
0 Kudos
StefanUseldinger
Occasional Contributor II

I don't understand the documentation to its full extent. Which hosts have to be added to the dockerExtraHosts? The Portal, a DNS,...?

0 Kudos
AlexLeonov
New Contributor II

I had a similar error on ArcGIS Notebook Server 11.1, but with another error code.

ConnectionError: A connection error has occurred: HTTPSConnectionPool(host='pvm-portal.esri-cis.com', port=7443): Max retries exceeded with url: /arcgis/sharing/rest/portals/self (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001F9A9F49970>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Adding the ArcGIS Portal host to the dockerExtraHosts variable does not solve the problem - the error remains. Please - what could be wrong? @ChristopherPawlyszyn 

 

 

{
  "maxExecuteNotebookContainersPerNode": 10,
  "dockerConnectionPort": 2375,
  "maxContainersPerNode": 20,
  "containersStartPort": 30001,
  "diskSpaceThresholdGB": 5,
  "dockerExtraHosts": [{
    "hostname": "pvm-portal.esri-cis.com",
    "ip": "10.14.0.31"
  }],
  "idleNotebookThreshold": 720,
  "containerCreatedThreshold": 60,
  "useWindowsContainers": true,
  "allowedCORSRequestHeaders": "x-ms-blob-type,x-ms-version,x-ms-client-request-id,content-type",
  "webSocketSize": 16,
  "containersStopPort": 31000,
  "allowHiddenFileDownloads": false,
  "dockerConnectionHost": "localhost"
}

 

 

 

0 Kudos
AlexLeonov
New Contributor II

dockerExtraHosts variable doesn't work for me. Registering internal ip of portal in our dns solved the problem. ArcGIS Notebook Server with Windows containers can't work with ip's listed in hosts file on the host.

0 Kudos