I'm very new to python and I don't entirely understand versions and libraries, so there may be a simple solution to my problem.
I am working on a project in which it is vital that we visually display our simulation. I installed Vpython on Mac OSX 10.8.4 and so far visualizations work when running the program from the command line. However I'd like to use an IDE (Eclipse, Sublime Text, Spyder. Ideally Spyder) but whenever from visual import *
shows up, I get the following error:
>>> runfile(r'/Users/robinnewhouse/code/Spyder/astro/maintest.py', wdir=r'/Users/robinnewhouse/code/Spyder/astro')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 523, in runfile
execfile(filename, namespace)
File "/Users/robinnewhouse/code/Spyder/astro/maintest.py", line 7, in <module>
from visual import *
ImportError: No module named visual
So I tried using Spyder's PYTHONPATH manager to add the path to the package. I got the same error.
Then in a last ditch effort, I tried to manually add the "visual" package to Spyder's directory of included packages (/Applications/Spyder.app/Contents/Resources/lib/python2.7/) and I got a different (albeit worse) error: Fatal Python error: PyThreadState_Get: no current thread
I have no idea how to deal with this issue, but the most frustrating part is that if I run the same file in command line, it works fine. (speaking of which, if it helps, the version of python that comes up when I use which python
is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
Thanks for any advice you can offer.
(Spyder dev here) The right solution is this: In Spyder you need to go
Tools > Preferences > Console > Advanced Settings > Python Executable
and then change the file that appears there to be
/usr/bin/python
However, before doing this you need to reinstall Spyder again, because you added the visual
module to it and now it's broken.