Closed 861 closed 8 years ago
As the exception indicates, it was not possible to import the glcanvas
submodule from the wx
package. Is it possible that you don't have PyOpenGL installed? Take a look here for more info.
I have also installed pyopengl on my pc
Please try running the example app at the link in my previous message and let me know the result.
Actually, you may want to try this example for more informative output:
I can run the demo correctly as follow:
Interesting. Please try the following:
Open a new python session and type:
>>> from wx import glcanvas
Then, exit python, open a new python session, and type:
>>> import wx
>>> from wx import glcanvas
Do both of those tests work for you without errors?
Ok. A few more things to clarify..
When you call view_cube
, are you using ipython or the standard python interpreter?
When you call view_cube
, are you doing it from an interactive ipython session?
Lastly, I notice you are using a script called "new.py". That is potentially dangerous because there is a standard python module named "new" and you could be masking it (see here). Please try renaming that file and see if the error goes away.
Thanks for your help!I just try it again!I can use the ipython run it correctly!But there is something wrong with the standard python interpreter!
For the interactive graphical functions of SPy to work, the ipython interpreter is required. But I'm still surprised by the import exception you received. Did changing the file name eliminate that error?
I have changed my file name ,But the exception is still exist
I also have another problem about the test!
Testing memmaps with BIL image file.
Saving C:\Users\Hmily\spectral\spectral_test_files\memmap_test_bil.img
Testing bil_memmap_read..................................... Traceback (most recent call last):
File "C:\WinPython-32bit-2.7.10.2\python-2.7.10\lib\runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "C:\WinPython-32bit-2.7.10.2\python-2.7.10\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\Hmily\spectral\spectral\tests\run.py", line 68, in
I can't explain your unit test error or why it would be related to the SPy module. The error is associated with a basic file-open operation. To figure out what is going on, you could create the directory (C:\Users\Hmily\spectral\spectral_test_files
) manually and try running the same command from the python command line to see if that works:
>>> open(u'C:\\Users\\Hmily\\spectral\\spectral_test_files\\memmap_test_bil.img', 'wb', 100)
If that works, I would retry running the SPy unit tests from a different directory (not from within the spectral
directory) and see if it works from there. If you still get the error, please report what versions of windows and python you are using.
I have tried the command:open(u'C:\\Users\\Hmily\\spectral\\spectral_test_files\\memmap_test_bil.img', 'wb', 100)
It worked!But when I retry unit tests in a different directory ,the error is still exist on win10 x64 ,python 2.7.10.I will try it on Ubuntu tomorrow.Thank you very much!
I'm closing this issue since the original problem was due to not running ipython. If the unit test error can be reproduced on another system (Windows or other), we'll create a separate issue.
I have installed wxPython on my win10 x64 correctly ,but when I use spectral.view_cube(img, bands=[0, 1, 2])
Traceback (most recent call last): File "N:\new.py", line 7, in
spectral.view_cube(img, bands=[0, 1, 2])
File "C:\WinPython-32bit-2.7.10.2\python-2.7.10\lib\site-packages\spectral\graphics\graphics.py", line 178, in view_cube
from spectral.graphics.hypercube import HypercubeWindow
File "C:\WinPython-32bit-2.7.10.2\python-2.7.10\lib\site-packages\spectral\graphics\hypercube.py", line 73, in
raise ImportError("Required dependency wx.glcanvas not present")
ImportError: Required dependency wx.glcanvas not present