ArcGIS API for Python no longer works after upgrade to ArcGIS Pro 2.5

3210
13
02-08-2020 02:42 PM
JohnHuillery1
Occasional Contributor

Error when attempting to import after upgrading to 2.5:

>>> from arcgis.gis import GIS
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\__init__.py", line 3, in <module>
from . import (features, geoanalytics, geocoding, geometry,
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\__init__.py", line 28, in <module>
from . import enrich_data
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\enrich_data.py", line 10, in <module>
import arcgis.network as network
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\network\__init__.py", line 7, in <module>
from ._layer import NetworkLayer, NetworkDataset, ClosestFacilityLayer, ServiceAreaLayer, RouteLayer, NAJob
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\network\_layer.py", line 8, in <module>
from arcgis.mapping import MapImageLayer
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\mapping\__init__.py", line 8, in <module>
from ._types import WebMap, WebScene, MapImageLayer, MapImageLayerManager, VectorTileLayer, OfflineMapAreaManager, PackagingJob
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\mapping\_types.py", line 19, in <module>
from arcgis.widgets import MapView
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\widgets\__init__.py", line 2, in <module>
from arcgis.widgets._mapview import MapView
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\widgets\_mapview.py", line 15, in <module>
from ipywidgets import widgets
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipywidgets\__init__.py", line 25, in <module>
from .widgets import *
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipywidgets\widgets\__init__.py", line 4, in <module>
from .widget import Widget, CallbackDispatcher, register, widget_serialization
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipywidgets\widgets\widget.py", line 18, in <module>
from ipykernel.comm import Comm
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipykernel\comm\__init__.py", line 1, in <module>
from .manager import *
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipykernel\comm\manager.py", line 15, in <module>
from .comm import Comm
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipykernel\comm\comm.py", line 9, in <module>
from ipykernel.kernelbase import Kernel
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\ipykernel\kernelbase.py", line 19, in <module>
from jupyter_client.session import utcnow as now
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\jupyter_client\session.py", line 56, in <module>
from zmq.eventloop.ioloop import IOLoop
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\zmq\eventloop\__init__.py", line 3, in <module>
from zmq.eventloop.ioloop import IOLoop
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\zmq\eventloop\ioloop.py", line 78, in <module>
while _IOLoop.configurable_default() is not _IOLoop:
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\tornado\ioloop.py", line 328, in configurable_default
from tornado.platform.asyncio import AsyncIOLoop
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\tornado\platform\asyncio.py", line 34, in <module>
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
AttributeError: module 'asyncio' has no attribute 'WindowsSelectorEventLoopPolicy'

0 Kudos
13 Replies
DanPatterson_Retired
MVP Esteemed Contributor

carried on over here

Spyder IDE no longer works after upgrade to ArcGIS Pro 2.5 

Do this

Or if you want a shortcut, navigate to one of these files in the installation path:

   jupyter-notebook-script.py

 jupyter-lab-script.py

Create a shortcut to it for your desktop

Right-click on the shortcut on your desktop and fix the parameters

Target:

C:\X\bin\Python\envs\arcgispro-py3\pythonw.exe

      "C:\arc_pro\bin\python\envs\arcgispro-py3\Scripts\jupyter-lab-script.py"

where X is Your_ArcGIS_Pro_Install_folder and note the double quotes around the last portion

Start in:

C:\Y

Where Y is some folder where you store your notebooks eg:

C:\Git_Dan\JupyterNoteBooks

0 Kudos
JohnHuillery1
Occasional Contributor

HiThe cmd window launches and closes immediately after I attempt either of those approaches.

I'm not concerned with Spyder anymore. I can use other IDEs. My issue is I can no longer import the ArcGIS for Python API after updating ArcGIS Pro to 2.5, so all of my automated processes no longer work.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

PS... if you made a "clone", there is a possibility that you have the wrong conda environment activated.  You can check that within ArcGIS Pro.  Make sure you switch into the environment ...C:\...X...\bin\Python\envs\arcgispro-py3 where X is your Pro installation folder.

You should be able to import the arcgis module from within the python window within Pro.  If you can't... proceed on.

Assuming failure of the above...

Then you have to "repair" ArcGIS Pro. 

From the start in Windows, search for Add/Remove programs, select Remove, then you will be given the option to repair.

If repair doesn't work, then you need to remove everything and start fresh.

That is my preference... "upgrading" might leave behind remnants of other stuff you installed along with Pro or options etc, that aren't any good anymore

My preference is to completely remove all traces of ArcGIS pro from my system... a basic uninstall should remove most, but I also check the c:\users\You\local... folder for any esri folder in the Apps folder and rename it with an "old" extension

Go to My Esri and download the exe into a folder... don't run it... download it,  and run the exe from that folder specifying that folder as the destination for unzipping/unpacking.

You will end up with a *.msi and *.cab file.  double-click on the msi and run it.

Also... make a folder for your installation so it isn't in the defaults.

I make and use an c:\arc_pro as the folder to install Pro into.  Better than that C:\Program.... location.

0 Kudos
JohnHuillery1
Occasional Contributor

Did another fresh install of ArcGIS Pro.  Now I cant even import pandas.  Also I have duplicate Python libraries (see below):

(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3>conda list
# packages in environment at C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3:
#
alabaster 0.7.12 py_0
arcgis 1.7.0 py36_863 esri
arcgis 1.7.1 py36_969 esri
arcgispro 2.5 0 esri
argh 0.26.2 py36_0
asn1crypto 1.3.0 py36_0
asn1crypto 0.24.0 py36_0
astroid 2.3.3 py36_0
atomicwrites 1.3.0 py36_1
attrs 19.1.0 py36_1
attrs 19.3.0 py_0
autopep8 1.4.4 py_0
babel 2.8.0 py_0
backcall 0.1.0 py36_0
bcrypt 3.1.7 py36he774522_0
beautifulsoup4 4.8.2 <pip>
blas 1.0 mkl
bleach 3.1.0 py36_0
bleach 3.1.0 py_0
ca-certificates 2020.1.1 0
ca-certificates 2019.8.28 0
certifi 2019.9.11 py36_0
certifi 2019.11.28 py36_0
cffi 1.12.3 py36h7a1dbc1_0
cffi 1.13.2 py36h7a1dbc1_0
cftime 1.0.0b1 py36h452e1ab_0
chardet 3.0.4 py36_1003
cloudpickle 1.2.2 py_0
colorama 0.4.3 py_0
colorama 0.4.1 py36_0
cryptography 2.7 py36_0 esri
cycler 0.10.0 py36h009560c_0
decorator 4.4.1 py_0
decorator 4.4.0 py36_1
defusedxml 0.6.0 py_0
despatch 0.1.0 py36_0 esri
diff-match-patch 20181111 py_0
docutils 0.16 py36_0
entrypoints 0.3 py36_0
et_xmlfile 1.0.1 py36h3d2d736_0
fastcache 1.1.0 py36he774522_0
flake8 3.7.9 py36_0
freetype 2.9.1 vc14_0 [vc14] esri
future 0.17.1 py36_0 esri
gdal 2.3.3 arcgispro_11 [arcgispro] esri
gdal 2.3.3 arcgispro_1 [arcgispro] esri
h5py 2.9.0 py36_arcgispro_2 [arcgispro] esri
html5lib 1.0.1 py_0
icc_rt 2019.0.4 arcgispro_0 [arcgispro] esri
icu 58.2 ha66f8fd_1
idna 2.8 py36_0
imagesize 1.2.0 py_0
importlib_metadata 0.19 py36_0
importlib_metadata 1.5.0 py36_0
inflect 4.1.0 py36_0
intel-openmp 2019.4 arcgispro_245 [arcgispro] esri
intervaltree 3.0.2 py_0
ipykernel 5.1.4 py36h39e3cac_0
ipykernel 5.1.2 py36h39e3cac_0
ipython 7.12.0 py36h5ca1d4c_0
ipython 7.8.0 py36h39e3cac_0
ipython_genutils 0.2.0 py36h3c5d0ee_0
ipywidgets 7.5.1 py_0
isort 4.3.21 py36_0
jaraco.itertools 5.0.0 py_0
jdcal 1.4.1 py_0
jedi 0.14.1 py36_0
jedi 0.15.1 py36_0 esri
jinja2 2.11.1 py_0
jinja2 2.10.1 py36_0
jpeg 9b hb83a4c4_2
json5 0.8.5 py36_0 esri
jsonschema 3.0.2 py36_0
jsonschema 3.2.0 py36_0
jupyter_client 5.3.1 py36_0 esri
jupyter_client 5.3.4 py36_0
jupyter_console 6.1.0 py_0
jupyter_console 6.0.0 py36_0
jupyter_core 4.6.1 py36_0
jupyter_core 4.5.0 py36_0 esri
jupyterlab 1.1.4 py36_0 esri
jupyterlab_server 1.0.6 py_0
keyring 19.0.2 py36_0 esri
kiwisolver 1.1.0 py36ha925a31_0
lazy-object-proxy 1.4.3 py36he774522_0
libpng 1.6.37 h2a8f88b_0
libsodium 1.0.18 0 esri
libspatialindex 1.9.3 h33f27b4_0
lxml 4.5.0 <pip>
markupsafe 1.1.1 py36he774522_0
matplotlib 3.1.1 py36_0e [arcgispro] esri
mccabe 0.6.1 py36_1
mistune 0.8.4 py36he774522_0
mkl 2019.4 arcgispro_245 [arcgispro] esri
mkl-service 2.3.0 py36hb782905_0
mkl_fft 1.0.14 py36h14836fe_0
mkl_fft 1.0.15 py36h14836fe_0
mkl_random 1.0.2 py36h343c172_0
mkl_random 1.1.0 py36h675688f_0
more-itertools 8.2.0 py_0
more-itertools 7.2.0 py36_0
mpmath 1.1.0 py36_0
nbconvert 5.5.0 py36_0 esri
nbformat 4.4.0 py36h3a5bc1b_0
nbformat 5.0.4 py_0
netcdf4 1.5.1.2 py36_arcgispro_1 [arcgispro] esri
nose 1.3.7 py36_2
notebook 6.0.1 py36_0
ntlm-auth 1.4.0 <pip>
numexpr 2.7.0 py36hdce8814_0
numexpr 2.7.0 py36h6288b17_0
numpy 1.16.6 py36h5510c5b_0
numpy 1.16.5 py36h19fb1c0_0
numpy-base 1.16.6 py36hc3f5095_0
numpy-base 1.16.5 py36hc3f5095_0
numpydoc 0.9.2 py_0
openpyxl 3.0.3 py_0
openpyxl 2.6.2 py_0
openssl 1.1.1d he774522_3
openssl 1.1.1d he774522_0
packaging 20.1 py_0
packaging 19.1 py36_0
pandas 0.25.1 py36ha925a31_0
pandas 1.0.0 py36h47e9c7a_0
pandocfilters 1.4.2 py36_1
paramiko 2.6.0 py36_0
parso 0.6.0 py_0
parso 0.5.1 py_0
pathtools 0.1.2 py_1
pexpect 4.8.0 py36_0
pickleshare 0.7.5 py36_0
Pillow 7.0.0 <pip>
pip 19.2.3 py36_0
pip 20.0.2 <pip>
pip 20.0.2 py36_1
pluggy 0.12.0 py_0
pluggy 0.13.1 py36_0
pro_notebook_integration 2.5 py36_5 esri
prometheus_client 0.7.1 py36_0 esri
prompt_toolkit 3.0.3 py_0
prompt_toolkit 2.0.9 py36_0
psutil 5.6.3 py36he774522_0
psutil 5.6.7 py36he774522_0
py 1.8.1 py_0
py 1.8.0 py36_0
pybind11 2.3.0 0 esri
pybind11 2.3.0 py36_0 esri
pycodestyle 2.5.0 py36_0
pycparser 2.19 py36_0
pycparser 2.19 py_0
pydocstyle 4.0.1 py_0
pyflakes 2.1.1 py36_0
pygments 2.4.2 py36_0 esri
pylint 2.4.4 py36_0
pynacl 1.3.0 py36h62dcd97_0
pyopenssl 19.0.0 py36_0
pyparsing 2.4.6 py_0
pyparsing 2.4.2 py_0
pypdf2 1.26.0 py_2 esri
PyPDF2 1.26.0 <pip>
pyqt 5.9.2 py36h6538335_2
pyrsistent 0.14.11 py36he774522_0
pyrsistent 0.15.7 py36he774522_0
pyshp 1.2.12 py36_0
pysocks 1.7.0 py36_0
pysocks 1.7.1 py36_0
pytest 4.6.5 py36_0 esri
python 3.6.9 1 esri
python-dateutil 2.8.1 py_0
python-dateutil 2.8.0 py36_0
python-jsonrpc-server 0.3.4 py_0
python-language-server 0.31.7 py36_0
pytz 2019.2 py36_0 esri
pywin32 227 <pip>
pywin32 227 py36he774522_1
pywin32-ctypes 0.2.0 py36_0 esri
pywin32-ctypes 0.2.0 py36he119be9_0 esri
pywinpty 0.5 py36_0 esri
pyyaml 3.12 py36h1d1928f_1
pyzmq 18.1.0 py36_0 esri
qdarkstyle 2.8 py_0
qt 5.9.7 vc14h73c81de_0
qtawesome 0.6.1 py_0
qtconsole 4.6.0 py_1
qtpy 1.9.0 py_0
reportlab 3.5.34 <pip>
requests 2.22.0 py36_0
requests 2.22.0 py36_1
requests-ntlm 1.1.0 <pip>
requests-toolbelt 0.9.1 <pip>
rope 0.16.0 py_0
rtree 0.9.3 py36h21ff451_0
scipy 1.3.1 py36h29ff71c_0
scipy 1.4.1 py36h9439919_0
send2trash 1.5.0 py36_0
setuptools 45.1.0 py36_0
setuptools 41.2.0 py36_0
SharePlum 0.2.0 <pip>
simplegeneric 0.8.1 py36_2
sip 4.19.8 py36h6538335_0
six 1.14.0 py36_0
six 1.12.0 py36_0
snowballstemmer 2.0.0 py_0
sortedcontainers 2.1.0 py36_0
soupsieve 1.9.5 <pip>
sphinx 2.3.1 py_0
sphinxcontrib-applehelp 1.0.1 py_0
sphinxcontrib-devhelp 1.0.1 py_0
sphinxcontrib-htmlhelp 1.0.2 py_0
sphinxcontrib-jsmath 1.0.1 py_0
sphinxcontrib-qthelp 1.0.2 py_0
sphinxcontrib-serializinghtml 1.1.3 py_0
spyder-kernels 1.8.1 py36_0
sqlite 3.29.0 he774522_0
sqlite 3.31.1 he774522_0
sympy 1.4 py36_0 esri
terminado 0.8.3 py36_0
terminado 0.8.2 py36_0
testpath 0.4.4 py_0
testpath 0.4.2 py36_0
tornado 6.0.3 py36he774522_0
tornado 6.0.3 py36he774522_1
traitlets 4.3.3 py36_0
traitlets 4.3.2 py36h096827d_0
typed-ast 1.4.1 py36he774522_0
ujson 1.35 py36hfa6e2cd_0
urllib3 1.25.8 py36_0
urllib3 1.24.2 py36_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
vs2015_runtime 14.16.27012 hf0eaf9b_0
watchdog 0.10.1 py36_0
wcwidth 0.1.8 py_0
wcwidth 0.1.7 py36h3d5aa90_0
webencodings 0.5.1 py36_1
wheel 0.33.6 py36_0
wheel 0.34.2 py36_0
widgetsnbextension 3.5.1 py36_0
win_inet_pton 1.1.0 py36_0
wincertstore 0.2 py36h7fe50ca_0
winkerberos 0.7.0 py36_1
winpty 0.4.3 4
wrapt 1.11.2 py36he774522_0
x86cpu 0.4 py36_1 esri
xeus 0.23.2 2 esri
xlrd 1.2.0 py_0
xlrd 1.2.0 py36_0
xlwt 1.3.0 py36h1a4751e_0
yaml 0.1.6 vc14_0 [vc14] esri
yapf 0.28.0 py_0
zeromq 4.3.2 0 esri
zipp 0.5.2 py_0
zipp 2.1.0 py_0
zlib 1.2.11 h62dcd97_3

I haven't installed any of these libraries. This is from the ArcGIS Pro install.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

That wasn't a clean wipe and fresh install, you now have duplicate packages. 

As suggested earlier, you have to remove all vestiges of anything Arc* and to be on the safe side, anything Python.  I won't even suggest doing a registry edit at this stage.

0 Kudos
JohnHuillery1
Occasional Contributor

I uninstalled ArcGIS Pro and deleted the ESRI folders in ..\AppData\Local and Roaming.  What else am I supposed to get rid of?

Also the only ArcGIS Pro install I have access to at the moment is 2.1 so I used that and updated to 2.5 through ArcGIS Pro>Project>About.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Updates will leave duplicates.

A clean install means downloading the *.exe from My Esri and not updating through ArcGIS Pro.

Just check that you only have 1 environment in arcgis pro from the Project backstage (in Python, Manage Environments.

You only have one python (3.6.9 which is correct )in your environment.

You can try to clone, but when you do, you have to switch into that environment before you install packages.

I don't clone, since I have full admin rights to my computer and I live on the edge and do all my installs there... that is because I have the *.msi and *.cab file from the *.exe from My Esri... so I can use .... the conda install --revision thing to roll back anything glitchy.

JohnHuillery1
Occasional Contributor

I only have one Python env. It is Python 3.6.9.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

As I said, that is correct

0 Kudos