ImportError: No module named numpy

18798
7
10-08-2013 12:03 PM
DanielJimenez2
New Contributor III
Hello, I'm trying to set up my python configuration to import arcpy to PythonWin, I'm using python 2.7.2 and using arcgis10.1, 
however I'm getting the following import error in pythonwin.


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


I have set a Desktop10.1.pth under C:\Python27\ArcGIS10.1\Lib\site-packages which includes:
C:\Program Files (x86)\ArcGIS\Desktop10.1\bin
C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Scripts


also if it helps my path looks like this:
PATH=C:\Program Files (x86)\Intel\MPI-RT\4.1.0.023\em64t\bin;C:\Program Files (x
86)\Intel\MPI-RT\4.1.0.023\ia32\bin;C:\Anaconda;C:\Anaconda\Scripts;C:\Program F
iles (x86)\Java\jdk1.6.0_27\bin;C:\oraclexe\app\oracle\product\10.2.0\server\bin
;C:\Program Files (x86)\ImageMagick-6.6.4-Q16;C:\Windows\system32;C:\Windows;C:\
Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Fil
es (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Crypto
systems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TC
G Software Stack\bin\;C:\Program Files\Wave Systems Corp\Gemalto\Access Client\v
5\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files
(x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\QuickTime
\QTSystem\;C:\Program Files (x86)\Graphviz2.26\bin;C:\Program Files\MySQL\MySQL
Server 5.1\bin\C:\Python26\Lib\site-packages\PyQt4;C:\Python26\GDAL\bin;C:\Progr
am Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft S
QL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:
\Program Files\TortoiseSVN\bin;C:\Python26\ArcGIS10.0\python.exe


Seems that arcpy is being imported but for some reason is looking for the numpy inside the same arcpy folder. How can i resolve the problem so i can import arcpy without any issues. If i need to provide more configuration options i'll gladly do it.
Thanks
Tags (2)
0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus
0 Kudos
DanielJimenez2
New Contributor III
I have look at some of them but seems that they are either using an older version of ArcGIS or aren't having the same problem I am currently having, I have tried to update my path so it looks at  C:\Python27\ArcGIS10.1\Lib\site-packages likes some sites have suggested but that did not help since now im getting the following error in pythonwin
>>> import arcpy
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named arcpy
>>> 


which seems that is not even looking at the folders. I don't know if adding a env variable would fix the problem but some sites suggest doing it, for some reason I think I might be doing it wrong.
A copy of my updated path
PATH=C:\Program Files (x86)\Intel\MPI-RT\4.1.0.023\em64t\bin;C:\Program Files (x
86)\Intel\MPI-RT\4.1.0.023\ia32\bin;C:\Anaconda;C:\Anaconda\Scripts;C:\Program F
iles (x86)\Java\jdk1.6.0_27\bin;C:\oraclexe\app\oracle\product\10.2.0\server\bin
;C:\Program Files (x86)\ImageMagick-6.6.4-Q16;C:\Windows\system32;C:\Windows;C:\
Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Fil
es (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Crypto
systems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TC
G Software Stack\bin\;C:\Program Files\Wave Systems Corp\Gemalto\Access Client\v
5\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files
(x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\QuickTime
\QTSystem\;C:\Program Files (x86)\Graphviz2.26\bin;C:\Program Files\MySQL\MySQL
Server 5.1\bin\C:\Python26\Lib\site-packages\PyQt4;C:\Python26\GDAL\bin;C:\Progr
am Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft S
QL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:
\Program Files\TortoiseSVN\bin;C:\Python27\ArcGIS10.1\Lib\site-packages
0 Kudos
ArkadiuszMatoszka
Occasional Contributor II
Hi,

Few questions:
How many instances of python you have installed on your computer?
Have you checked if C:\Python27\ArcGIS10.1\Lib\site-packages is in sys.path in python?
import sys
sys.path

Also some other folders should be there (ArcGISinstallPath\bin; ArcGISinstallPath\arcpy).
If some of them are missing, you can just append them at start of your script (before importing arcpy):
import sys
sys.path.append(path1)
sys.path.append(path2)
...
import arcpy


Also you can create new windows environment variable named PYTHONPATH and define paths that should be included in python.

Best Regards
Arek
0 Kudos
DanielJimenez2
New Contributor III
Thanks for answering my post, I tried to append all the paths but I'm still able to import arcpy to Pythonwin, I really don't understand what is wrong. Am I missing a step or omitting to add another path so far I added
>>> sys.path.append("C:\Python27\ArcGIS10.1\Lib\site-packages")
>>> sys.path.append("C:\Program Files (x86)\ArcGIS\Desktop10.1\bin")
>>> sys.path.append("C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy")

>>> sys.path
['', 'C:\\opus\\src', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\Lib\\site-packages\\pythonwin', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\ArcGIS10.1\\Lib\\site-packages', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\x08in', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\x07rcpy']


I have added all the paths I think should be there yet I'm still getting the same error, any thoughts of why this is happening

>>> import acrpy
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named acrpy


thanks for the help
0 Kudos
DanielJimenez2
New Contributor III
Were you able to resolve this issue?  I'm have the same failures and have tried all the variations of path I've been able to find but have still not succeeded.

Thanks


Yes I was able following the tip step in http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z00000008000000. Here is how my Desktop10.1.pth   file looks like:
C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.1\bin
C:\Python27\ArcGIS10.1\Lib\site-packages

and here is the f.pth file path:

C:\Python27\Lib\site-packages
so pretty much just create a file with the locations of your arcpy, bin and site-packages folders

after that I was able to import arcpy without any problem

Hope this helps.
0 Kudos
BenDrury
Occasional Contributor
we were having the same issue on several computers.  The process outlined here http://mattmakesmaps.com/blog/2013/07/10/fixing-arcgis-10-dot-1-python-console-numpy-import-error/ fixed it for us.
KrunalLathiya
New Contributor

Your error means you don't have a numpy library installed in your machine.

You can simply install numpy using one of the following commands.

pip install numpy

Or for python3, use

pip3 install numpy

If you are using tools like Anaconda then you can install it using the following command.

conda install numpy

If you have an older version of numpy then you can upgrade numpy as well.

I hope this helps.

Best regards,

0 Kudos