I use Ubuntu as my operating system and have GRASS GIS installed through the ubuntugis-unstable repository. Everything has been working great. Then I installed the landsat-util tool and all sorts of ‘stuff’ started getting installed and updated. I know I should have kept an eye on what it was going to do but I was in a rush and just said ‘Y’ whenever prompted. Bad practice. Anyway, the upshot was that landsat-util installed and worked perfectly, but GRASS GIS fell over. It would not load the GUI. Damn!
The message I was getting was something along the lines of
This module requires the Numeric/numarray or NumPy module, which could not be imported. It probably is not installed
(it's not part of the standard Python distribution). See the Numeric Python site (http://numpy.scipy.org) for information on
downloading source or binaries.
ImportError: Numeric,numarray or NumPy not found.
When I checked in Python, I had
numpy installed, so that wasn’t the issue.
I couldn’t find anything useful online to help me fix it but then I thought, it’s Python and it’s open source. Let’s have a hack!
I opened the following file (if I was more leet I would have used vim or nano or something):
sudo geany /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py
I then went to line 117 and added the first three lines shown in the code block below, remembering to alter all the indents etc:
try: import numpy as _Numeric except: try: import numpy.oldnumeric as _Numeric except: try: import numarray as _Numeric #if numarray is used it is renamed Numeric except: try: import Numeric as _Numeric except: msg= """ This module requires the Numeric/numarray or NumPy module, which could not be imported. It probably is not installed (it's not part of the standard Python distribution). See the Numeric Python site (http://numpy.scipy.org) for information on downloading source or binaries.""" raise ImportError, "Numeric,numarray or NumPy not found. \n" + msg
I then saved the file and restarted GRASS and it all (seems) to be running smoothly and as it should do.
Disclaimer: Now I’m no programmer, just a hacker of code and general tinkerer. Your mileage may vary, but if this is of use to anyone then that’s great. It’s of use to me and that’ll do me fine.
Reblogged this on Geoger Ltd. and commented:
This may or may not be of useful to someone out there, but I thought it was worth highlighting.
Thanks for your help! One thing to note is that when I copied and pasted your lines of code, geany interpreted some of the tabs as spaces, so I suggest that anyone who tries this indents manually to avoid any further errors.
This worked for me on GRASS 6.4.4. Python 2.7 and Debian 8. My file was named /usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/lib/plot.py instead of 2.8. Thank you for sharing your hack!
Thanks for your comments – glad that the post was useful to others too
bravo my friend
THANK you So much! your post about Fixing Grass saved me!
Fixed my problem, many thanks.