I have developed code to label points that pull formatting from a dictionary. I developed this code and it was working fine two weeks ago, today I try to open my map and I am now met with an error which I can't seem to trace in the code.

Before anyone marks my question as a duplicate, I have previously asked unrelated questions about this code

here: Using Python Dictionary to label subscript formatting ArcMap 10.6 [duplicate]

and here: Labeling using chemical formulas in subscripts that contain a mask in ArcMap 10.6

The error I am currently stuck on is:

"Error 0 on line 0

Traceback (most recent call last): File "< string >", line 1, in < module >

File "c:\programfiles(x86)\arcpy\arcpy_init.py", line 20, in < module >

import numpy

Import Error: No module named numpy

enter image description here

The code I am working with is:

def FindLabel ( [WellShape.GWMW_NAME], [2018ExceedanceFigureData-PEMLF_Mhuber.csv.SPRING_EXC], [2018ExceedanceFigureData-PEMLF_Mhuber.csv.FALL_EXC] ):
    a = [2018ExceedanceFigureData-PEMLF_Mhuber.csv.SPRING_EXC]     
    b = [2018ExceedanceFigureData-PEMLF_Mhuber.csv.FALL_EXC]     
    formats = {
        'SiO2': 'SiO<sub>2</sub>',
        'CO32-': 'CO<sub>3</sub><sup>2-</sup>',
        'HCO3-': 'HCO<sub>3</sub><sup>-</sup>',
        'CaCO3': 'CaCO<sub>3</sub>',
        'NH3': 'NH<sub>3</sub>',
        'NO3-': 'NO<sub>3</sub><sup>-</sup>',
        'NO2-': 'NO<sub>2</sub><sup>-</sup>',
        'NO3-+NO2-': 'NO<sub>3</sub><sup>-</sup>+NO<sub>2</sub><sup>-</sup>',
        'OH-': 'OH<sup>-</sup>',
        'NO2-': 'NO<sub>2</sub><sup>-</sup>',
        'Br-': 'Br<sup>-</sup>',
        'SO42-': 'SO<sub>4</sub><sup>2-</sup>'
    c = [str(i.strip(',')) for i in a[1:-1].split()]
    d = [str(i.strip(',')) for i in b[1:-1].split()]
    e = ','.join([formats.get(i,i) for i in c])    
    f = ','.join([formats.get(i,i) for i in d])
    if a == "(-)" and b != "(-)":
        return "{}\r\n <FNT scale='70'><CLR red='0' green='122' blue='192'>({})</CLR></FNT>".format( [WellShape.GWMW_NAME] ,f )
    elif a != "(-)" and b == "(-)":
        return "{}\r\n <FNT scale='70'><CLR red='255' green='0' blue='255'>({})</CLR></FNT>".format( [WellShape.GWMW_NAME] ,e )
    elif a != "(-)" and b != "(-)":
        return "{}\r\n <FNT scale='70'><CLR red='255' green='0' blue='255'>({})</CLR>\r\n<CLR red='0' green='122' blue='192'>({})</CLR></FNT>".format( [WellShape.GWMW_NAME] ,e ,f )
    elif a == "(-)" and b == "(-)":
        return [WellShape.GWMW_NAME] 

Do you have any suggestions for finding/fixing this error?

I've already restarted my computer and application thinking the glitch may not be in the code (as it was working fine just a few weeks ago).

I am using ArcMap 10.6 and havent changed recently.

However my python updated on March 4th from 3.7.2 to 2.7.16... maybe this new version has an issue with numpy?

  • Try simplifying your label expression to see if you can isolate what is breaking it against your data. Contemplate whether it is maybe your data rather than the expression.
    – PolyGeo
    Commented Mar 6, 2019 at 20:26
  • 1
    Also, all errors should be provided as text rather than pictures. The mention of numpy at the end of this one may help someone resolve it but potential answerers often overlook errors presented in pictures.
    – PolyGeo
    Commented Mar 6, 2019 at 20:38
  • My immediate suspicions fall on your data, you have hyphens in your fields names an multiple dots. I would simplify your field names, out of interest what is your data source, it is clear not a file geodatabase?
    – Hornbydd
    Commented Mar 7, 2019 at 23:59
  • I have joined my data with another table, thus why the field names have dots. Theres no way around this really as I will need to join additional data. But the error isnt saying "feature not found" which is what this type of error would likely produce. I've tried using both a feature class and a shapeffile to join with my table, both used to work. I'm starting to think it was the newest python update that pushed to my computer on March 4th, 2.7.16 (might have a glitch where it can't import numpy) Commented Mar 8, 2019 at 15:24
  • 1
    Have you installed numpy? The error shows up, because your code is trying to import numpy, but it can't find it. So either you don't have numpy installed or something is wrong with your installation.
    – Blinxen
    Commented Mar 8, 2019 at 15:45

1 Answer 1


Turns out Python updated (automatically), and the new version was either corrupt or didn't install right.

I tried reinstalling ArcGIS, and also repairing it with no luck.

After contacting ESRI Tech Support, they recommended step 4 of this article : Problem: Unable to import arcpy I had to manually delete the ArcGIS10.x folders under C:\Python27 before running the installation tool to Repair.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.