jupyter notebook python runtime errors

68
2
08-12-2022 07:40 AM
mattkyles
New Contributor

I am encountering runtime errors divide by zeros errors simply importing numpy and pandas into a blank Jupyter note book. there is no data in the note book yet to even work on. Any idea if its something on my computers end or Anacondas end. Im pretty lost as this error is all over. i attached the most basic error.

0 Kudos
2 Replies
BrianWilson7
Regular Contributor

I'm assuming you are running from a notebook inside ArcGIS Pro? There are many different ways to run notebooks.

Your screen grab just shows the middle part of the error trace. The interesting parts are usually at the beginning and the end. All I can tell for sure is that your path is loading the modules that live in your Downloads folder, 

C:\Users\mtruc\Downloads\study\lib\... looks to me like something that got installed maybe when you did a class or something?? so who knows what version of numpy it's finding. One that is not compatible with your Esri environment.

If you are working in Pro you can see what the environment shows, go to Project -> Python and it should say at the top the name of the current environment like "arcgispro-py3" and list the packages it is using.

On mine at 2.9 it shows numpy version 1.20.1 but ArcPro won't show the source of the package. From a command line I can do this

$ conda activate C:/Program\ Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3
(arcgispro-py3)
bwilson@ccis4501 MINGW64 ~/Documents/ArcGIS
$ conda list numpy
# packages in environment at C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3:
#
# Name                    Version                   Build  Channel
numpy                     1.20.1                   py37_0    esri
numpy-base                1.20.1                   py37_0    esri

The first command "conda activate" I give the entire path to the environment, you can probably just do something like "conda activate arcgispro-py3" if you have a more standard environment.

The second command lists the "channel". In this case it shows "esri". I am thinking yours might show a different version and channel? Give it a try.

How to recover? Hm. I do hacky things that might not help you. 🙂 The proper way would be to use the conda tools. But maybe you have shunted over to a different environment and all you need to do is select the right one in the Python Package Manager, click on "Manage Environments" and pick one. If it works, you can probably remove the broken one in there too once you have moved back onto one that works.

 

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

If you are using any version of numpy other than the one installed by Pro, then you will have errors since numpy can't be upgraded to a higher version than allowed by arcpy

For Pro 3.0.1

(arcgispro-py3) C:\...YourInstallFolder...\bin\Python\envs\arcgispro-py3>conda list numpy
# packages in environment at C:\...YourInstallFolder...\bin\Python\envs\arcgispro-py3:
#
# Name                    Version                   Build  Channel
numpy                     1.20.1                   py39_0    esri
numpy-base                1.20.1                   py39_0    esri
numpydoc                  1.4.0            py39haa95532_0

(arcgispro-py3) C:\arc_pro\bin\Python\envs\arcgispro-py3>

Skip the notebook for now and try the imports in your python IDE or the python window within Pro to see if you have a proper installation of Pro


... sort of retired...
0 Kudos