Home

  If you're new to Python
  and VPython: Introduction

  A VPython tutorial

  Introductory Videos

  Pictures of 3D objects

  

  

  

  VPython 7 web site
  VPython license

Running locally, plus information for developers

When internet access is missing or poor, you may find it useful to run locally, independent of the internet. At vpython.org, in the section on using VPython without installing software, see the instructions for how to use Web VPython without an internet connection. Before going offline, use the download options at glowscript.org to get local copies of your programs.

Another option is to install Python and the VPython 7 module. At vpython.org see the section on using VPython with installed Python. As long as you don't import Python modules other than vpython, you will also be able to run the program at glowscript.org without having to make changes.

Yet another option is to follow the instructions below. Even if you do not wish to help develop VPython, you might want to install the GlowScript machinery on your computer, to be able to use it without access to the internet.

 

For developers
If you want to be able to contribute to developing VPython, here are the (rather complex) steps required to be able to run locally with changes that you make to the code, almost all of which is written in JavaScript (there is also some Python server code and some html code). An excellent, up to date textbook on JavaScript is available at javascript.info.

(1) Watch a YouTube overview of the VPython architecture:
    tinyurl.com/GSarchitecture
At a later time you should also study this document:
    GlowScriptOverview.md

(2) Download the Web VPython source files
At the repository on GitHub, https://github.com/vpython/glowscript, click "Clone or download" and then clone the repository, or click on "Download ZIP" and unpack the contents of the glowscript-master folder into a new local folder named glowscript.

(3) Install the Google Cloud SDK for Python
At developers.google.com/appengine/downloads choose Standard environment Python for your platform. Next, if you have not already installed the Google Cloud SDK ("Software Development Kit"), do this:
1) Click the Download button for "Install and initialize Google Cloud SDK" and then click "Cloud SDK installer". Run this installer, which will install a Python 2.7 (which is required by the Google software) unless you uncheck "Bundled Python". Let it execute "gcloud init" for you.
3) In a command-line terminal, execute the following statement (on Mac or Linux, you may need to preface this command with "sudo"):
    gcloud components install app-engine-python

(4) Using gcloud with Google App Engine
To run Web VPython, execute
    dev_appserver.py /..../glowscript/app.yaml
where the location of the Web VPython code is at
    /..../glowscript (on Windows, use backslashes instead of slashes).

Then start a browser and enter "localhost:8080" to run Web VPython.

Alternatively, change directory ("cd") to the glowscript folder you downloaded, and execute
    dev_appserver.py app.yaml

More precisely, 8080 is the default port number. At the start of ide/api.py, if the variable "localport" is XXXX instead of 8080, to start up the application you must execute
     dev_appserver.py --port=XXXX /..../glowscript/app.yaml
and the browser must point to "localhost:XXXX".

(5) Testing your changes
Suppose the current version of Web VPython is 3.0. Change the version number in a program to 3.1dev; that is, 0.1 greater than the current 3.0, plus dev. When you run the program, it will use your latest JavaScript changes. If you make further changes to the JavaScript code, just re-execute a test program to get the latest changes. You don't have to restart the application.

If you want to remake/update the existing version 3.0, or create a new version 3.1, see MakingNewVersion.txt in the docs folder of the Web VPython GitHub repository. Note that use of the build program requires that there be an appropriate version of node in the build-tools folder.

It is very useful to insert console.log(....) at critical points in the JavaScript code, which will generate output to the web page that is viewable if you turn on the browser developer console. On Chrome or Edge just press Ctrl-Shift-j.

(6) Save your test programs
Updates to the Google software can have the effect that you lose the VPython programs you used for testing purposes. On Windows these programs are stored in C:\Users\YourName\AppData\Local\Temp\appengine.glowscript. On Mac, look for datastore.db in /private/var/folders/..... It is highly recommended that you keep a copy of the programs folder before updating the Google software.



Important: The "original App Engine SDK" described below, with its graphical user interface, will no longer be available after July 30, 2020, at which time it will be necessary to use the "gcloud" mechanism documented above.

* Install the Google App Engine SDK for Python
At developers.google.com/appengine/downloads, download the package for your platform. Choose Standard environment Python, then scroll down and click "Download and install the original App Engine SDK for Python". If using Linux, unpack to a folder whose name will probably be google_appengine.

* On Windows and Mac, the Google App Engine installer includes an app "Google APP Engine Launcher" which simplifies launching Web VPython.

On Windows, there will be a Google App Engine Launcher icon on your desktop, or in your Start menu. Run the app.

On Mac, drag the GoogleAppEngineLauncher out of the installer package (for example, drag it into the Applications folder), then double-click it. When asked, accept the offer to create some symlinks.

In the Launcher, choose File > Add Existing Application and specify the glowscript folder. Make a note of the Port number. Click Add. In ide/api.py and untrusted/run.js, search for "localhost:" and adjust the port number to the number assigned by the launcher.

With the glowscript entry selected in the launcher, click the green Run button. When the Browse button lights up, click it, which will run your standard browser (which should be Chrome or Edge for best error reporting).

Click Sign in, then click Login and use the name "test". Write or import a program and check that it runs properly.

* On Ubuntu, in a terminal cd to the google_appengine folder and execute
python dev_appserver.py ../glowscript

Next open a browser, preferably an up-to-date version of Chrome (which gives the best error reporting).

Enter as a URL "localhost:8080"

Click Sign in, then click Login and use the name "test".