VIDLE with Anaconda Python 2.7.10 ?

331 views
Skip to first unread message

Jennifer Hoffman

unread,
Sep 13, 2015, 10:00:33 PM9/13/15
to VPython-users

I am trying to use vpython, any way I can, but I'm failing...


About a month ago, I had already installed the Anaconda Python 2.7.10 on Win 8.1.


Today, I installed Vpython by typing into the command line: conda install -c https://conda.binstar.org/mwcraig vpython


Then I tried 3 things:


(1) Double-click the "VIDLE for VPython" shortcut on my desktop. Nothing happens. I look at the target, which points to pythonw.exe. I double-click directly on pythonw.exe. Nothing happens.


(2) I notice that there is also python.exe in the same folder, so I double-click on it, and get a command prompt. I type "from visual import *" and it seems to execute without error. Then I type "sphere()" and opens up a gray window titled "vpython" but it just hangs without ever showing me a sphere.


(3) Then I launched spyder, and typed "from visual import *", which seemed to execute without error. Then I typed sphere(), and it spits out the text "visual_common.primitives.sphere at 0x152ccb38" and another gray window pops up with the title "vpython" but it also hangs indefinitely.

[Note I already searched the forum and found & implemented M Craig's instructions to change the preferences->console->advanced settings->python interpreter to pythonw.exe

but it hasn't solved my problem. Furthermore, this interpreter setting seems to reset to python.exe every time I close & relaunch Spyder.]


How can I debug this situation? Thanks so much! I'd really like to show a simple vpython script in my physics lecture tomorrow...

Doug Blank

unread,
Sep 13, 2015, 10:10:50 PM9/13/15
to vpytho...@googlegroups.com
Perhaps someone can help with the details of your installation, but you could create an account here: http://www.glowscript.org/

and do your demo from the web. Good luck!

-Doug

--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruce Sherwood

unread,
Sep 13, 2015, 11:58:26 PM9/13/15
to vpytho...@googlegroups.com
Dunno what to make of Case 1, but Case 2 and maybe Case 3 are understandable, because there has to be a loop, whether implicit or explicit, in order to be able to render the scene. A good test is to put the following program in a file named "test.py" next to the python.exe and pythonw.exe:

from visual import *
box()

Then in the directory execute "python test.py". You should see a rotatable, zoomable white cube. If you do see this, evidently the problem is either the VIDLE icon or VIDLE itself.

Matt Craig

unread,
Sep 14, 2015, 9:30:18 AM9/14/15
to VPython-users
Hi Jennifer,

I'll make some time to look into this later today, but in the short run if go with Doug's suggestion to use glowscript.

Matt

Jennifer Hoffman

unread,
Sep 14, 2015, 12:03:33 PM9/14/15
to VPython-users
Thanks everybody! Now that I have glowscript working, my problem is not urgent.
When I get a chance, I'll uninstall & reinstall everything and see if that work.

But one more question: is there any reason to suspect that it won't work with Python 2.7.10?
The version listed on the vpython installation instructions is 2.7.9

Bruce Sherwood

unread,
Sep 14, 2015, 3:18:28 PM9/14/15
to vpytho...@googlegroups.com
No, there shouldn't be any difference between various Python 2.7.xx's as far as VPython is concerned. The download pages at vpython.org aren't always quite up to date with respect to the xx minor version of Python 2.7, mainly because it doesn't matter very much.

Tom Kelley

unread,
Jul 18, 2016, 12:36:57 PM7/18/16
to VPython-users
I know this post is basically a year old, but if anyone is still there. I'm having the exact problem that Jennifer Hoffman has described. I'm using anaconda and have successfully installed two environments for python 3.5 and 2.7. 
While in 2.7, vidle is unrecognized as a command, but I can open spyder and run the following program at the end of my post with no problem (kernel does crash after completion)but cannot run a simple command such as box() or sphere(). Any suggestions on what I can do to make vpython run more smoothly?

 
 
from visual import *
ball
= sphere(pos=(-5,0,0), radius=0.05, color=color.cyan)
wallR
= box(pos=(6,0,0), size=(0.2,12,12), color=color.green)
wallL
= box(pos=(-6,0,0), size=(0.2,12,12), color=color.green)
wallT
= box(pos=(0,6,0), size=(12,0.2,12), color=color.blue)
wallB
= box(pos=(0,-6,0), size=(12,0.2,12), color=color.blue)
wallBG
= box(pos=(0,0,-6), size=(12,12,0.2), color=color.red)
wallFG
= box(pos=(0,0,6), size=(12,12,0.2), color=color.red, opacity=0)
ball
.velocity = vector(25,5,15)
ball
.trail = curve(color=ball.color)
vscale
= 0.05 #scales vector
cor
= 1 #reflection coefficient
varr
= arrow(pos=ball.pos, axis=vscale*ball.velocity, color=color.yellow)
deltat
= 0.005
t
= 0
scene
.autoscale = False
while t < 90:
    rate
(100) # limits the number of times loop can execute per minute
   
if (ball.pos.x+ball.radius) > (wallR.pos.x-wallR.size.x):
        ball
.velocity.x = -cor*ball.velocity.x
   
if (ball.pos.x-ball.radius) < (wallL.pos.x+wallL.size.x):
        ball
.velocity.x = -cor*ball.velocity.x
   
if (ball.pos.y+ball.radius) > (wallT.pos.y-wallT.size.y):
        ball
.velocity.y = -cor*ball.velocity.y
   
if (ball.pos.y-ball.radius) < (wallB.pos.y+wallB.size.y):
        ball
.velocity.y = -cor*ball.velocity.y
   
if (ball.pos.z+ball.radius) > (wallFG.pos.z-wallFG.size.z):
        ball
.velocity.z = -cor*ball.velocity.z
   
if (ball.pos.z-ball.radius) < (wallBG.pos.z+wallBG.size.z):
        ball
.velocity.z = -cor*ball.velocity.z
    ball
.pos = ball.pos + ball.velocity*deltat
    ball
.trail.append(pos=ball.pos)
    varr
.pos = ball.pos
    varr
.axis = vscale*ball.velocity
    t
= t + deltat



Bruce Sherwood

unread,
Jul 18, 2016, 12:46:47 PM7/18/16
to VPython-users
If by "cannot run a simple command such as box() or sphere()" you mean that it doesn't work to try to execute "box()" from a terminal, that is because this can't work without some rather complex procedure, because the wxpython interact function needs to be driven repeatedly.

As for VIDLE not being available, it should be available by executing the program at site-packages\vidle\idle.py

You also have an alternative, Jupyter VPython: see the first page of vpython.org.
Reply all
Reply to author
Forward
0 new messages