VPython for Physics 33.151


We will be using an extension to the Python programming language known as Visual Python, or VPython. The follwoing provides instructions on installing VPython on your computer. We strongly reccomend installing VPython 6.11 which requires Python 2.7. The generic download for VPython-wx is on SourceForge, but please follow the operating-system specific directions below. These directions were taken from older installation pages in case they become unavailable. You can find the original pages at:
Download for Windows
Download for Mac
Download for Linux

Windows downloads for VPython 6

If you have an old VPython 6.x installed, it's a good idea to uninstall it before installing the new VPython 6.11. Go to Control Panel > Uninstall a program and select the old VPython.

A version that works on all Windows computers:

First, download and install the 32-bit Python-2.7.9 from python.org. Be sure to allow the installer to install into C:\Python27.

Second, install VPython-Win-32-Py2.7-6.11. This version of VPython requires Python 2.7.x from python.org; it will not work with versions of Python other than the one from python.org.

A version that requires a 64-bit Windows computer:

First, download and install the 64-bit Python-2.7.9 from python.org Be sure to allow the installer to install into C:\Python27.

Second, install VPython-Win-64-Py2.7-6.11. This version of VPython requires Python 2.7.x from python.org; it will not work with versions of Python other than the one from python.org.

There is an older VPython 5.74 for Python 3.2.

Installing for Anaconda

If you are using the Anaconda Python distribution, you can install VPython by typing the following in a Command Prompt (but only for Python 2.7):

conda install -c mwcraig vpython

Mac downloads for VPython 6

If you already have a version of VPython 6, it's a good idea to uninstall it before installing the new VPython 6.11. (If you have VPython 5 installed, you need to delete the old folders visual, vis, and vidle from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages.)

Generic Mac Instructions

First, download and install Python-2.7.9 from python.org.

Second, install VPython-Mac-Py2.7-6.11. This version of VPython requires Python 2.7.x from python.org. VPython will not work with the version of Python 2.7 that is part of the standard OSX, nor will it work with versions of Python other than the one from python.org.

Install VPython

Open the VPython installer.

If you have an old VPython 6.x installed, uninstall it:
Doubleclick vpy_uninstall. (Alternatively, you can run "sudo vpy_uninstall.sh" in a Terminal.) You may get the message "can't be opened because it is from an unidentified developer; your security preferences allow installation of only apps from the Mac App Store and identified developers". In this case, go to System Preferences on the Apple menu and choose Security & Privacy. Click the button "Open Anyway" for the VPython uninstaller. This will start the uninstaller.

Now install the new VPython 6.11:
You may need to reopen the VPython installer.
Doubleclick VPython-Mac-Py2.7-6.11.pkg.
You may get the message "can't be opened because it is from an unidentified developer; your security preferences allow installation of only apps from the Mac App Store and identified developers". In this case, go to System Preferences on the Apple menu and choose Security & Privacy. Click the button "Open Anyway" for the VPython installer. This will start the installer.

Third, if you have not previously installed VPython 6.x, install Active Tcl.
Ctrl-click the ActiveTcl-8.6.pkg icon and choose Open. If asked, then click the Open button. When asked where to install, choose your computer disk. After installation, drag the installer folder from the Desktop to the Trash. This repairs a problem with the Tcl library needed by Python.

These are "universal" installers for 32-bit and 64-bit Macintosh computers, usable with OSX 10.6 or later.
If you are using the Enthought version of Python 2.7 on a Macintosh, you can use VPython-Mac-Enthought7.3-6.04.dmg.

There is an older VPython 5.74 for Python 3.2. Installing for Anaconda
If you are using the Anaconda Python distribution, you can install VPython by typing the following in a Terminal (but only for Python 2.7):

conda install -c mwcraig vpython

Linux Downloads for VPython

Linux downloads for VPython 6, using Wine

Your Linux distribution may already have a VPython package, which on Ubuntu is named python-visual. However, it is likely to be very far out of date. It is recommended to run the latest Windows version of VPython under Wine (www.winehq.org). Wine lets you run Windows programs on Linux. It is not an emulator; VPython under Wine runs at normal speed. Your Linux distribution probably has a Wine package. You will need the following Windows files:

For 32-bit Linux:

Download the 32-bit Python-2.7.9 from python.org
Download the Windows 32-bit library file python27.dll.
Download VPython-Win-32-Py2.7-6.11.This version of VPython requires Python 2.7.x from python.org.

For 64-bit Linux:

Download the 64-bit Python-2.7.9 from python.org
Download the Windows 64-bit library file python27.dll
Download VPython-Win-64-Py2.7-6.11. This version of VPython requires Python 2.7.x from python.org.

Installing VPython 6 under Wine

Install Wine, which is probably available in your Linux distribution packages.
Run the Wine configure program. Here you will have the opportunity to choose the look and feel of execution (e.g. XP, Windows 7, etc.).
Assume that in your Downloads folder the downloaded installers are named Python2.7.msi and VPython.exe. In a terminal, execute the following (adjust the file name Python2.7.msi appropriately):

cd ~/Downloads
wine msiexec /i Python2.7.msi /qn TARGETDIR=C:\Python27 ALLUSERS=1

Copy python27.dll into ~/.wine/drive_c/windows/system32. At least on some Linux distributions you can press Ctrl-H to hide or unhide hidden folders such as .wine when viewing files in the file browser.
Run the Wine configure program again. In Applications, if it is not already there,
click Add application,
choose Python27, and
doubleclick python.exe.
Then in Libraries, in "New override for library", enter python27.dll, and click Add.
Select python27.dll in "Existing_overrides" and click Edit.
Click "Native (Windows)".
Click OK.

At this point you should have a working Windows version of Python 2.7, which you can test by executing this in a terminal:

wine ~/.wine/drive_c/Python27/python

Next, in the ~/Downloads folder, right-click VPython.exe (or whatever the downloaded VPython installer is called) and choose "Open With Wine Windows Program Loader". This will start the VPython installer. You might get error messages asking for help in finding Python 2.7, which is located at ~/.wine/drive_c/Python27. This will put the "VIDLE for VPython" icon on your Linux desktop. Double-click this icon, which should start up VIDLE. On the File menu choose Open and pick one of the VPython example programs.

There is (at least) one bug: In VIDLE, if you choose Help > VPython, you get an error. The VPython documentation can be accessed by doubleclicking ~/.wine/drive_c/Python27/Lib/site-packages/visual/docs/index.html. You might wish to bookmark this location in your browser.

Building from source for VPython 6

Building from source is difficult because a large number of dependencies must be satisfied. Here is the source code: vpython-wx-src.6.11.tgz. Be sure to study the file INSTALL.txt for instructions on building VPython.
Aishwarya Unnikrishnan has created a script that simplified installation on Linux, at least for Ubuntu Linux:
https://github.com/katanachan/installer/blob/master/VisualPythonInstaller.sh
If you have an existing VPython, you will need to delete the old folders visual, vis, and vidle from site-packages or dist-packages.
There is an older VPython 5.74 for Python 3.2.
Maintained by C.A. Meyer