I have been having problems with the solution deployment tool where I get an error saying it "Unable to Initialize. Failed to connect to source portal". The solution I was trying to deploy was the Incident Status Dashboard but I get the message on all solutions and switching to different ArcGIS online accounts does not solve the error.
I did some troubleshooting by upgrading Pro to 2.3.2 and updated the deployment tool to version 2019.3.19 on Windows 10 but the issue has not gone away.
Does anyone know what might be causing the error?
Thanks Brady
Hi Brady,
This is sometimes caused by an issue in python not being able to connect to Arcgis Online, often related to a proxy. Could you try the following to narrow down the issue?
import arcgis
online = arcgis.GIS()
print(online)
It would be helpful if you could send back what is printed to the python window.
Chris, thanks for the response. Here is what I got when I followed the steps above.
Traceback (most recent call last):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 964, in send
self.connect()
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1392, in connect
super().connect()
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\socket.py", line 724, in create_connection
raise err
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 332, in __init__
raise e
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 320, in __init__
referer=self._referer)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\portalpy.py", line 163, in __init__
client_id=client_id)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py", line 290, in __init__
self.login(username, password, expiration, client_id)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py", line 536, in login
resp = self.post('', { 'f': 'json' }, add_token=False) # probe portal to find auth scheme
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\connection.py", line 1107, in post
resp = opener.open(url, data=encoded_postdata.encode())
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 544, in _open
'_open', req)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>
Hi Brady,
The code you executed is the basic logic to make an anonymous connection to ArcGIS Online which is what the solution deployment tool needs to deploy the solutions to your org. Something in your environment is preventing python from making this connection. For example sometimes people try the same from their home network and it works fine, something on their work network causes it to fail. I don't have a lot of experience in this area, my recommendation would be to contact Technical Support to troubleshoot your environment and specifically why you can't make this anonymous connection to ArcGIS Online through python. If you resolve this issue, it should resolve the issue with the Solution Deployment tool failing.
-Chris
Hi there, I had the very same issue ans resolved it !
Following this thread about bypassing proxy : python - requests: how to disable / bypass proxy - Stack Overflow
I succeeded in connecting anonymously to AGOL with the code :
import os
import requests
os.environ['NO_PROXY'] = 'arcgis.com'
import arcgis
online = arcgis.GIS()
print(online)
And then was able to deploy the tool using ArcGIS Solution
Hope this will help you