Arcpy not working outside of ArcGIS

4540
10
Jump to solution
12-23-2014 07:44 AM
RusselKlueg
New Contributor III

I'm having an issue importing arcpy into my Python scripts outside of ArcGIS. I've completely uninstalled Python and deleted the directory. I then used the 10.2 install disc to repair my version of ArcGIS hoping that doing so would correct any issues  created from having python 2.7 installed prior to ArcGIS 10.2 installation. Yet after the repair I tried to run my .py file and it gave me this error again. (Error attached as jpg)

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

so if everything is ok as shown in this link in the help files   then a complete reinstall might be in order

View solution in original post

0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

Sounds like something is amiss

1  do you have multiple versions of python installed

2  assuming you are using the version of python required for your version of arcmap, it should look like this for arcmap 10.2.x

C:\Python27\ArcGIS10.2\.....

plus a bunch of others.

0 Kudos
RusselKlueg
New Contributor III

This is my only directory under python 27

C:\Python27\ArcGIS10.2

which is what the ArcGIS 10.2 disc installed after I completely uninstalled python. The attachment also shows all the files located under that directory.

I feel it might be useful to mention thought, that under the directory below, arcpy can be found. It just seems to me there is a connection issue between python / IDLE and my actual arcpy library. But I'm not skilled in how to fix an issue like this.

C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy

0 Kudos
DanPatterson_Retired
MVP Emeritus

can you get past the import line in the interactive window

>>>
>>> # done within the interactive window of both pyscripter and pythonwin
>>>
>>> import arcpy     # if it fails here... python is not installed properly
>>> # now get some information
>>> arcpy.__name__
'arcpy'
>>> arcpy.__path__
['C:\\Program Files (x86)\\ArcGIS\\Desktop10.2\\arcpy\\arcpy']
0 Kudos
RusselKlueg
New Contributor III

I can get past it if im not trying to import arcpy. I have a few other scripts that run smoothly. The issue only arises when I am trying to do anything that requires me to import arcpy.

0 Kudos
DanPatterson_Retired
MVP Emeritus

in order to use arcpy in a script, it needs to be imported...If you can't get past the import line, then python and/or Arcmap has not been installed properly.

0 Kudos
RusselKlueg
New Contributor III

I know that's my issue. I had python 2.7 installed prior to installing ArcGIS, so I uninstalled python from the computer completely then used the ArcGIS 10.2 install disc to reinstall it assuming the disc would install it properly. Yet I still have the disconnect when trying to import arcpy after doing all of that and I don't understand what I'm doing wrong to fix it.

0 Kudos
DanPatterson_Retired
MVP Emeritus

so if everything is ok as shown in this link in the help files   then a complete reinstall might be in order

0 Kudos
RusselKlueg
New Contributor III

I was actually in the process of reinstalling everything from the start as you posted that. It fixed the issue. Thanks again for your help!

0 Kudos
DanPatterson_Retired
MVP Emeritus

Thank goodness!!! have a great holiday

0 Kudos