Arcpy import fail

5143
7
Jump to solution
01-26-2015 01:34 PM
DanielErklauer
New Contributor III

I've got a fresh install of 10.2.2 why can't I import arcpy in pythonwin? I get the following result:

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\toolbox.py", line 356, in <module>
    from management import Graph, GraphTemplate
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 22, in <module>
    import _management
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\_management.py", line 14, in <module>
    import _graph
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\_graph.py", line 27, in <module>
    import numpy
ImportError: No module named numpy
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

In both cases, I installed them without having to fiddle with anything.  Both installs found the python directory and its binaries which are in the C:\Python27\ArcGIS10.2....yaddy yadditty folder which is only slightly different than an install without arcmap.

Pythonwin ends up here:   C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\Pythonwin.exe

Pyscripter here: "C:\Program Files (x86)\PyScripter\PyScripter.exe" --PYTHON27

Both play nice together and as a 'parent' with 50 teaching computers to work with, that is important.

The only time I have seen 'issues' are with those that want to install versions of Python that are different than that required for ArcMap.  They either try to install higher versions of Python or the wrong versions of pythonwin or pyscripter.  I solve that problem by installing those on separate machines without ArcMap...for pure python work ...since I am not convinced that the 'play nice' rule will be adhered to.  As soon as someone suggests monkeying around with registratries and path files...I just say no...since this would have to be done by many students who want to work with their educational versions at home.  It is kind of a 'my house...my rules' scenario, but it works for me

View solution in original post

7 Replies
DarrenWiens2
MVP Honored Contributor

It looks like it's having trouble finding numpy. Is there a numpy folder in: C:\Python27\ArcGIS10.2\Lib\site-packages (or wherever your python is)?

0 Kudos
DanielErklauer
New Contributor III

Yes I have two directories in C:\Python27


1.C:\Python27\ArcGIS10.2

2. C:\Python27\ArcGISx6410.2

and both have numpy in \Lib\site-packages

0 Kudos
DanPatterson_Retired
MVP Emeritus

Pythonwin is a separate install and not installed by default, if memory serves.  I downloaded the version (several locations online) for ArcMap ... the 32 bit version for python 2.7.x (whether you have a 64 bit machine or not).  You might as well download and install Pyscripter as well.  Both are great free python IDEs, and I use them simultaneously with Arcmap.

0 Kudos
DanielErklauer
New Contributor III

Dan your right it is not installed by default but it comes with ESRI or at least it use to, that's how I ended up using it.  I don't care to much about the IDE as long as it work with arcpy so I can test things.  If I install Pyscripter will I be able to run my scripts though windows manager to automate them?  and whats the process for setting the environments for Pyscripter so it will us the arcpy library?

0 Kudos
DanPatterson_Retired
MVP Emeritus

In both cases, I installed them without having to fiddle with anything.  Both installs found the python directory and its binaries which are in the C:\Python27\ArcGIS10.2....yaddy yadditty folder which is only slightly different than an install without arcmap.

Pythonwin ends up here:   C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\Pythonwin.exe

Pyscripter here: "C:\Program Files (x86)\PyScripter\PyScripter.exe" --PYTHON27

Both play nice together and as a 'parent' with 50 teaching computers to work with, that is important.

The only time I have seen 'issues' are with those that want to install versions of Python that are different than that required for ArcMap.  They either try to install higher versions of Python or the wrong versions of pythonwin or pyscripter.  I solve that problem by installing those on separate machines without ArcMap...for pure python work ...since I am not convinced that the 'play nice' rule will be adhered to.  As soon as someone suggests monkeying around with registratries and path files...I just say no...since this would have to be done by many students who want to work with their educational versions at home.  It is kind of a 'my house...my rules' scenario, but it works for me

DanielErklauer
New Contributor III

That's a good point on separate installs for ESRI machines and development.

0 Kudos
DanPatterson_Retired
MVP Emeritus

And to add to that, I have had a couple of instances where I installed python packages...didn't like them...uninstalled them, then had issues with python (small...but didn't affect arc* more importantly).  Machines are cheap...time isn't

0 Kudos