0

I'm experimenting with the "SPy" Spectral Python library, using PyCharm, and I've gotten to the point where it tells me that wxversion was not found. How can I install wxversion?

I'm very new to Python in general, so am I doing something else wrong? Here is my code:

import matplotlib
#matplotlib.use('WX')    #Replaced by editing matplotlibrc
from spectral import *

img = open_image('92AV3C.lan')
print img.__class__
print
print img
print
print img.shape
pixel = img[50,100]
print
print pixel.shape
band6 = img[:,:,5]
print
print band6.shape
print


arr = img.load() 
print arr.__class__
print
print arr.info()
print
print arr.shape

view = imshow(img, (29, 19, 9))

All of which is from the SPy guide here: http://www.spectralpython.net/user_guide.html

Here is the error:

Traceback (most recent call last):
  File "/Users/pkillam/PycharmProjects/untitled/SPy Experiments", line 36, in <module>
  File "/Library/Python/2.7/site-packages/spectral/graphics/spypylab.py", line 1238, in imshow
    import matplotlib.pyplot as plt
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 98, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/__init__.py", line 28, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_wxagg.py", line 6, in <module>
    import backend_wx    # already uses wxversion.ensureMinimal('2.8')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_wx.py", line 53, in <module>
    raise ImportError(missingwxversion)
ImportError: Matplotlib backend_wx and backend_wxagg require wxversion, which was not found.

Also, are there any other guides/tutorials out there for SPy?

bogatron
  • 18,639
  • 6
  • 53
  • 47
NGXII
  • 407
  • 2
  • 9
  • 18
  • 1
    See http://matplotlib.org/users/installing.html#windows for how to install on windows. You are missing a dependency (Wx). – tacaswell Jul 16 '15 at 23:57
  • Please **do not** post text as an image. Not only is it not searchable, screen readers for the visually impaired do not work with images. Just copy and paste into your question, formatting as code just as you did with your actual code. – MattDMo Jul 17 '15 at 00:03
  • Error message has been recreated as text, thanks for the heads up. Also, I've tried to install wxpython using homebrew, and it claims it was successful, though I have a feeling that PyCharm has either no idea where it is, or homebrew failed. Unfortunately, I am using a mac, and would much rather be using a windows machine... – NGXII Jul 17 '15 at 00:48
  • Newer versions (IIRC as of 2.5 already) of wxPython do install wxversion. http://wiki.wxpython.org/MultiVersionInstalls Maybe ask on the pycharm list? – Werner Jul 17 '15 at 09:27

1 Answers1

1

You can install wxPython on Mac just by downloading it from www.wxpython.org. Please take note of the following notice on their website:

NOTE: This installer is not signed by Apple, so by default your Mac will tell you it is corrupted and will not install it. You can get around this by temporarily relaxing the security settings in System Preferences. In the Security & Privacy section set "Allow applications downloaded from" to "Anywhere."

I have followed their directions and had no problem installing wxPython on Mac (Yosemite) once I changed those settings.

Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88