VPython missing visual module on clean install

4,611 views
Skip to first unread message

jdk...@anderson.edu

unread,
Jan 13, 2017, 1:17:40 PM1/13/17
to VPython-users
Greetings!

I am attempting to use VPython for the first time. I have been using Anaconda version 4.2.15. Following the instructions on vpython.org, I entered the following in my terminal (I'm on a Mac):

> conda install -c vpython vpython

then

conda update -c vpython vpython

It 
It seems to have installed correctly (I do not get any error messages). Then I go into Jupyter and create a new VPython file on the desktop. The only line I enter is

> from visual import *

and it gives the error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-e32a8874fc19> in <module>()
----> 1 from visual import *

ImportError: No module named 'visual'

Have I missed anything? I have tried doing this several other ways, so maybe I've made an error there. I've also tried deleting all the vpython folders from my anaconda directory and retrying (not sure I got them all though). Any help would be very much appreciated.

Sincerely,
Josiah

Bruce Sherwood

unread,
Jan 13, 2017, 1:49:10 PM1/13/17
to VPython-users
It should be "from vpython import *". Classic VPython used the name "visual" for the module, but Jupyter VPython uses the name "vpython".

jdk...@anderson.edu

unread,
Jan 13, 2017, 2:17:05 PM1/13/17
to VPython-users
Ah, of course. It seems I was looking at some old examples. Thank you!

Physixtential

unread,
Jul 27, 2017, 2:47:48 PM7/27/17
to VPython-users
I just had to reinstall anaconda and vpython and I am being forced to use this "from vpython import *", but it is also forcing me to use vec for all of my vectors, and materials are not supported, and it seems to be trying to run in glowscript, yet I am on python 2 not python 3 (proof in that I can use print, not print(). I really want to avoid having to redo all my code to work with the new vec requirement, and I don't want to lose materials. Is there any way to escape this? The old method of installing python "conda install -c https://conda.binstar.org/mwcraig vpython" does not work, despite still being listed on the vpython website, and the only way I can get it to install is conda install -c vpython vpython, which results in needing to use vec and no materials.

Aaron Titus

unread,
Jul 27, 2017, 3:17:39 PM7/27/17
to vpytho...@googlegroups.com
If you are interested in “classic” vpython (i.e. the old vpython that uses wxpython), then install it with anaconda using:

conda install -c mwcraig vpython


Then run your programs from the command line with:

 pythonw filename

Aaron

--
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,
Jul 27, 2017, 4:19:09 PM7/27/17
to VPython-users
Thanks for reporting the non-working conda link. At vpython.org I've replaced it with the one Aaron Titus has provided.

There exists a tool for updating old code, to permit using VPython 7 (and GlowScript VPython). At glowscript.org, click Help and scroll to "For those who have used Classic VPython". There you will find a conversion program that can't do a perfect job but which takes care of the most common differences, described like this:

Many programs written in Classic VPython 6 will run in GlowScript VPython or VPython 7 without change after being run through a conversion program written in Python. This program converts(x,y,z) => vector(x,y,z) and obj.x => obj.pos.x. These changes are necessary because GlowScript does not recognize (x,y,z) as a vector nor obj.x as a shorthand for obj.pos.x. The program also converts display => canvas and gdisplay => graph.

One of the things it can't convert is materials to textures.

Bruce Sherwood

unread,
Jul 27, 2017, 4:20:54 PM7/27/17
to VPython-users
I should add that VPython 7 does run with Python 2.7 in a Jupyter notebook, though not from an IDE such as IDLE or Spyder.
Reply all
Reply to author
Forward
0 new messages