Standalone ArcPy Anaconda Distribution for ArcGIS Pro 3.0 crashes Jupyter Notebook Kernel in VSCode

2770
13
06-26-2022 06:39 AM
feralcatcolonist_old
Occasional Contributor II

After creating a new ArcPy environment within a standalone installation of Anaconda, any attempt to import ArcPy within a VSCode Jupyter Notebook crashes the kernel.

This same setup worked without any issues since ArcPy was released on Anaconda in 2.7.

ArcPy also successfully imports within a standard Jupyter Notebook launched from the standalone installation of Anaconda.

This is a bare-bones recipe for creating an ArcPy environment within Anaconda.

 

 

conda create -n esri
conda activate esri
conda install -c esri arcpy

 

 

 


Likes an array of [cats, gardening, photography]
13 Replies
DanPatterson
MVP Esteemed Contributor

you might as well clone the arcgis-pro environment rather than just the arcpy package since there is little difference... except arcgis is not installed by default along with all of the jupyter stuff.  What was at one time, is not longer the case especially if you intend to use notebooks or jupyter (within or without Pro)


... sort of retired...
0 Kudos
feralcatcolonist_old
Occasional Contributor II

I'm certainly aware of the alternatives to get a working environment; however, the point of releasing ArcPy via the Anaconda distribution is so you can tailor your environment and not need to clone the environment that comes with the ArcGIS Pro software.

Pre-2.7 this is what we were all forced to do if we wanted ArcPy outside of the software. If this was an issue in 2.7-2.9 I wouldn't be bothered, but the Anaconda distribution worked as advertised in those releases. This is a capability degradation that needs to be addressed.


Likes an array of [cats, gardening, photography]
DanPatterson
MVP Esteemed Contributor

Good, just be aware that the required packages for Pro have changed.  I was having issues with package bloat during beta and had a hard time getting just what I needed.  You may have to check that the new requirements don't interfere with your standalone environment.


... sort of retired...
0 Kudos
DanPatterson
MVP Esteemed Contributor

Addendum.... arcgis requires jupyter-client <= 6.1.12  if your jupyter stuff uses it and the version is different check it out.  arcpy requires arcgis now in its current configuration


... sort of retired...
0 Kudos
feralcatcolonist_old
Occasional Contributor II

Yeah all of that is currently, and should rightfully be, handled by Anaconda.

It's a head-scratcher why ArcPy would work in a regular Jupyter Notebook but would crash the kernel of a VSCode Jupyter Notebook.

And on another level, why would a clone of the shipped environment not crash a VSCode Jupyter Notebook. Obviously some issue with how Esri packaged it in Anaconda.


Likes an array of [cats, gardening, photography]
Shaun-Walbridge
New Contributor II

Can you provide the output of `conda list` on the created environment? Depending on what else is present in the environment, it may be that conda isn't picking up the latest release of ArcPy by the bare installation command. At Pro 3.0, we had an across-the-system requirement to upgrade to OpenSSL 3, but this release is not yet being used by the Anaconda distribution as a default build of Python. That in turn means you'll need the Python build from the Esri channel. That said, the conda list output should help clarify.

Cheers,
Shaun

0 Kudos
DanPatterson
MVP Esteemed Contributor

Shaun, 

# Name Version Build Channel
openssl 3.0.3 2 esri
pyopenssl 22.0.0 pyhd3eb1b0_0

For me, this must mean that installing final didn't downgrade the packages installed during Beta then (?). 


... sort of retired...
0 Kudos
feralcatcolonist_old
Occasional Contributor II

Hi @Shaun-Walbridge, this is everything that comes default with ArcPy as currently loaded in Anaconda. It breaks a Jupyter Notebook upon import in VSCode, but works fine utilizing the regular/vanilla Jupyter Notebook environment.

# packages in environment at C:\Users\------\Anaconda3\envs\esri2:
#
# Name Version Build Channel
arcgis 2.0.1 py39_2826 esri
arcgispro 3.0 0 esri
arcpy 3.0 py39_arcgispro_36045 [arcgispro] esri
arrow-cpp 1.0.1 10 esri
asn1crypto 1.5.1 py39haa95532_0
atomicwrites 1.4.0 py_0
attrs 21.4.0 pyhd3eb1b0_0
azure-core 1.12.0 py_0 esri
azure-storage-blob 12.8.0 py_0 esri
backcall 0.2.0 pyhd3eb1b0_0
black 22.1.0 py39_3 esri
blas 1.0 mkl
bleach 4.1.0 pyhd3eb1b0_0
blinker 1.4 py39haa95532_0
bottleneck 1.3.4 py39h080aedc_0
brotlipy 0.7.0 py39h2bbff1b_1003
cachetools 4.2.2 pyhd3eb1b0_0
certifi 2022.6.15 py39haa95532_0
cffi 1.15.0 py39h2bbff1b_1
cftime 1.5.0 py39_1 esri
chardet 4.0.0 py39haa95532_1003
charset-normalizer 2.0.4 pyhd3eb1b0_0
click 8.0.4 py39haa95532_0
colorama 0.4.4 pyhd3eb1b0_0
cppzmq 4.4.1 4 esri
cryptography 37.0.2 py39_5 esri
cycler 0.11.0 pyhd3eb1b0_0
decorator 5.1.1 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
despatch 0.2.0 py39_0 esri
entrypoints 0.4 py39haa95532_0
et_xmlfile 1.1.0 py39haa95532_0
flake8 4.0.1 pyhd3eb1b0_1
freetype 2.12.1 0 esri
future 0.18.2 py39_2 esri
gdal 3.4.0 arcgispro_py39_17119 [arcgispro] esri
geomet 0.3.0 py_1 esri
h5py 3.6.0 py39_4 esri
html5lib 1.1 pyhd3eb1b0_0
icc_rt 2019.0.5 arcgispro_0 [arcgispro] esri
idna 3.3 pyhd3eb1b0_0
importlib-metadata 4.11.3 py39haa95532_0
importlib_metadata 4.11.3 hd3eb1b0_0
iniconfig 1.1.1 pyhd3eb1b0_0
intel-openmp 2020.0 arcgispro_166 [arcgispro] esri
ipykernel 5.3.4 py39h7b7c402_0
ipython 7.21.0 py39_2 esri
ipython_genutils 0.2.0 pyhd3eb1b0_1
ipywidgets 7.6.5 py_0 esri
isodate 0.6.0 py_0 esri
jdcal 1.4.1 pyhd3eb1b0_0
jedi 0.18.0 py39_0 esri
jinja2 3.0.3 pyhd3eb1b0_0
jpeg 9d 0 esri
json5 0.9.5 py_0 esri
jsonschema 4.4.0 py39haa95532_0
jupyter_client 6.1.7 py_1 esri
jupyter_console 6.4.0 py_1 esri
jupyter_contrib_core 0.3.3 py_4 esri
jupyter_contrib_nbextensions 0.5.1 py_24 esri
jupyter_core 4.6.3 py39_2 esri
jupyter_highlight_selected_word 0.2.0 py_4 esri
jupyter_latex_envs 1.4.6 py_3 esri
jupyter_nbextensions_configurator 0.4.1 py_3 esri
jupyterlab 2.2.10 py_0 esri
jupyterlab_server 1.2.0 py_0
jupyterlab_widgets 1.0.0 pyhd3eb1b0_1
keyring 23.4.0 py39_0 esri
kiwisolver 1.4.2 py39hd77b12b_0
lerc 3.0 pyh39e3cac_0 esri
libdeflate 1.8 h2bbff1b_5
libpng 1.6.37 h2a8f88b_0
libprotobuf 3.20.1 h23ce68f_0
libsodium 1.0.18 2 esri
libtiff 4.3.0 1 esri
libxml2 2.9.12 arcgispro_0 [arcgispro] esri
libxslt 1.1.34 he774522_0
lxml 4.8.0 py39h1985fb9_0
lz4-c 1.9.3 h2bbff1b_1
markupsafe 2.1.1 py39h2bbff1b_0
matplotlib 3.4.3 py39_arcgispro_4 [arcgispro] esri
matplotlib-base 3.4.3 py39_arcgispro_4 [arcgispro] esri
mccabe 0.7.0 pyhd3eb1b0_0
mistune 0.8.4 py39h2bbff1b_1000
mkl 2020.0 arcgispro_167 [arcgispro] esri
mkl-service 2.3.0 py39_2 esri
mkl_fft 1.3.0 py39_0 esri
mkl_random 1.2.2 py39_0 esri
mpmath 1.2.1 py39haa95532_0
msrest 0.6.21 py_0 esri
mypy_extensions 0.4.3 py39haa95532_1
nbconvert 5.6.1 py39_1 esri
nbformat 5.1.3 py_1 esri
netcdf4 1.5.7 py39_arcgispro_3 [arcgispro] esri
networkx 2.7.1 pyhd3eb1b0_0
nlohmann_json 3.7.0 2 esri
nose 1.3.7 pyhd3eb1b0_1008
notebook 5.7.10 py39_1 esri
ntlm-auth 1.4.0 py_0 esri
numexpr 2.8.1 py39_0 esri
numpy 1.20.1 py39_0 esri
numpy-base 1.20.1 py39_0 esri
oauthlib 3.2.0 py39_0 esri
openpyxl 3.0.9 pyhd3eb1b0_0
openssl 3.0.3 2 esri
packaging 21.3 pyhd3eb1b0_0
pandas 1.3.5 py39h6214cd6_0
pandocfilters 1.5.0 pyhd3eb1b0_0
parso 0.8.3 pyhd3eb1b0_0
pathspec 0.9.0 py_0 esri
pefile 2019.4.18 py_0
pickleshare 0.7.5 pyhd3eb1b0_1003
pillow 9.1.0 py39_3 esri
pip 21.2.4 py39haa95532_0
platformdirs 2.4.0 pyhd3eb1b0_0
pluggy 0.13.1 py39haa95532_0
pro_notebook_integration 3.0 py39_1 esri
prometheus_client 0.8.0 py_0 esri
prompt_toolkit 3.0.5 py_0 esri
protobuf 3.20.1 py39hd77b12b_0
psutil 5.8.0 py39h2bbff1b_1
py 1.11.0 pyhd3eb1b0_0
pyarrow 1.0.1 py39_3 esri
pybind11 2.7.1 0 esri
pybind11_json 0.2.6 3 esri
pycodestyle 2.8.0 pyhd3eb1b0_0
pycparser 2.21 pyhd3eb1b0_0
pyflakes 2.4.0 pyhd3eb1b0_0
pygments 2.9.0 py_0 esri
pyjwt 2.4.0 py_1 esri
pyodbc 4.0.32 py39hd77b12b_1
pyopenssl 22.0.0 pyhd3eb1b0_0
pyparsing 3.0.4 pyhd3eb1b0_0
pypdf2 1.26.0 py_4 esri
pyrsistent 0.18.0 py39h196d8e1_0
pyshp 2.1.3 pyhd3eb1b0_0
pysocks 1.7.1 py39haa95532_0
pytest 6.2.4 py39_0 esri
python 3.9.11 3 esri
python-certifi-win32 1.6 py_0 esri
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.9 1_cp39 esri
pytz 2022.1 py39_0 esri
pywin32-ctypes 0.2.0 py39_0 esri
pywin32-security 302 py39_1 esri
pywinpty 2.0.1 py39_0 esri
pyyaml 6.0 py39h2bbff1b_1
pyzmq 22.2.1 py39_0 esri
requests 2.27.1 pyhd3eb1b0_0
requests-kerberos 0.12.0 0 esri
requests-negotiate-sspi 0.5.3 py39_0 esri
requests-oauthlib 1.3.0 py_0
requests-toolbelt 0.9.1 pyhd3eb1b0_0
requests_ntlm 1.1.0 py_0 esri
saspy 3.7.8 py_0 esri
scipy 1.6.2 py39_0 esri
send2trash 1.8.0 pyhd3eb1b0_1
setuptools 60.10.0 py39_0 esri
simplegeneric 0.8.1 py39haa95532_2
six 1.16.0 py_0 esri
sqlalchemy 1.3.12 py39h196d8e1_0
sqlite 3.38.2 0 esri
swat 1.9.3 py39_0 esri
sympy 1.9 py39_1 esri
terminado 0.13.1 py39haa95532_0
testpath 0.5.0 py_0 esri
toml 0.10.2 pyhd3eb1b0_0
tomli 1.2.2 pyhd3eb1b0_0
tornado 6.1 py39h2bbff1b_0
traitlets 5.1.1 pyhd3eb1b0_0
typed-ast 1.4.3 py39h2bbff1b_1
typing-extensions 4.1.1 hd3eb1b0_0
typing_extensions 4.1.1 pyh06a4308_0
ujson 5.1.0 py39hd77b12b_0
urllib3 1.26.9 py39haa95532_0
vc 14.2 h21ff451_1
vs2015_runtime 14.27.29016 h5e58377_2 esri
wcwidth 0.2.5 pyhd3eb1b0_0
webencodings 0.5.1 py39haa95532_1
wheel 0.37.1 pyhd3eb1b0_0
widgetsnbextension 3.5.2 py39haa95532_0
win_inet_pton 1.1.0 py39_0 esri
wincertstore 0.2 py39haa95532_2
winkerberos 0.8.0 py39_0 esri
winpty 0.4.3 4
wrapt 1.13.3 py39h2bbff1b_2
x86cpu 0.4 py39_1 esri
xarray 0.20.1 pyhd3eb1b0_1
xeus 0.24.1 8 esri
xeus-python 0.8.2 10 esri
xlrd 2.0.1 pyhd3eb1b0_0
xlwt 1.3.0 py39haa95532_0
xtl 0.6.15 1 esri
xz 5.2.5 h8cc25b3_1
yaml 0.2.5 0 esri
zeromq 4.3.4 0 esri
zipp 3.8.0 py39haa95532_0
zlib 1.2.12 h8cc25b3_2
zlib-ng 2.0.5 0 esri
zstd 1.4.9 h19a0ad4_0


Likes an array of [cats, gardening, photography]
0 Kudos
ShaunWalbridge
Esri Regular Contributor

Thanks for posting these details. We've logged an internal issue on this, I don't think it is related to the build that is hosted on anaconda.org, but something more subtle. Issues of this class aren't trivial to debug because they are removed from our stack and introduce a number of VSCode specific elements that are difficult to isolate. The VSCode help documentation is along the lines of "something is wrong with your environment" if this is the case, but that is not a useful diagnostic to separate out a cause. We do test that VSCode works with the out of the box environment, and are creating an environment where we can reproduce this issue with Pro 3.0.

0 Kudos