+ Reply to Thread
Results 1 to 5 of 5

Thread: No module named numpy

  1. #1
    Stacie Wolny
    Join Date
    Apr 2010
    Posts
    26
    Points
    3
    Answers Provided
    0


    0

    Default No module named numpy

    Hi, all -

    I've just installed ArcMap 9.3.1 and am trying to use numpy in a Python script called from ArcToolbox, but I get this error: <type 'exceptions.ImportError'>: No module named numpy.

    I know it's installed, and if I bring up a python shell and "import * from numpy" it works fine.

    Spatial Statistics tools don't work either, some giving the same numpy error as above, others with variations on this:
    <type 'exceptions.ImportError'>: Bad magic number in C:\Program Files (x86)\lib\subprocess.pyc. Sometimes the error is for random.pyc.

    So far I've tried reinstalling just python and numpy, didn't help, nor did reinstalling all of 9.3.1. I made sure that there are no older versions of python on the machine and either deleted or renamed every ArcMap/ESRI directory I could find, in case an old setting was hanging around. I'm starting to think that there's a greater problem, as I tried Arc 10 and it was a nightmare, crashing regularly and with missing libraries (functools when trying to use Raster Calculator), when a colleague running the same OS (Windows XP Professional x64) has had none of the same problems with either 9.3.1 or 10.

    Any ideas would be greatly appreciated...

    ~ Stacie

  2. #2
    Luke Pinner
    Join Date
    May 2010
    Posts
    317
    Points
    284
    Answers Provided
    32


    0

    Default Re: No module named numpy

    Sounds like you've got some setup/installation issues as you say. Can't help there, but regarding numpy, you could try setting the path to numpy explicitly before importing.

    e.g
    Code:
    import sys
    sys.path.append(<path to numpy>)
    import numpy

  3. #3
    Stacie Wolny
    Join Date
    Apr 2010
    Posts
    26
    Points
    3
    Answers Provided
    0


    0

    Default Re: No module named numpy

    Thanks - I'll give it a try. It will at least be a workaround until I figure out the underlying problem.

    ~ Stacie

  4. #4
    Santha Rubini
    Join Date
    Mar 2012
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Unhappy Re: No module named numpy

    Hi Stacie,
    I am trying to run OLS for my data and I get the same error <type 'exceptions.ImportError'>: No module named numpy.
    could you tell me how did you fix this. also it will be great if yo could tell me how you used numpy in python (the flow of fixing it in steps will be highly useful)

    with Thanks,
    Ruby


    Quote Originally Posted by stush View Post
    Hi, all -

    I've just installed ArcMap 9.3.1 and am trying to use numpy in a Python script called from ArcToolbox, but I get this error: <type 'exceptions.ImportError'>: No module named numpy.

    I know it's installed, and if I bring up a python shell and "import * from numpy" it works fine.

    Spatial Statistics tools don't work either, some giving the same numpy error as above, others with variations on this:
    <type 'exceptions.ImportError'>: Bad magic number in C:\Program Files (x86)\lib\subprocess.pyc. Sometimes the error is for random.pyc.

    So far I've tried reinstalling just python and numpy, didn't help, nor did reinstalling all of 9.3.1. I made sure that there are no older versions of python on the machine and either deleted or renamed every ArcMap/ESRI directory I could find, in case an old setting was hanging around. I'm starting to think that there's a greater problem, as I tried Arc 10 and it was a nightmare, crashing regularly and with missing libraries (functools when trying to use Raster Calculator), when a colleague running the same OS (Windows XP Professional x64) has had none of the same problems with either 9.3.1 or 10.

    Any ideas would be greatly appreciated...

    ~ Stacie

  5. #5
    Stacie Wolny
    Join Date
    Apr 2010
    Posts
    26
    Points
    3
    Answers Provided
    0


    0

    Default Re: No module named numpy

    Hi Ruby -

    I wish I could tell you exactly what fixed it, other than a tech at ESRI fussed with my machine for so long that I stopped paying attention (very sorry that I didn't at least note the final fix.) What I do remember is that there were python libraries from an old version of python where they shouldn't have been, like an old distribution that didn't uninstall correctly. ArcMap was apparently looking in this wrong folder, which existed but didn't have all of the necessary files. What I can recommend is uninstalling your version of python, then look around on the machine for any python installation files/folders that might not have been cleaned up (maybe do a whole system search to be sure) and delete them. Also look in your system Environment variables, in case there's a path pointing to a wrong place. Reboot, then try installing again.

    ~ Stacie

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts