0

NameError: name 'gsprint' is not defined

I repeatedly get this error message when trying to run this:

from vpython import *
box()

I am using Python 3.7.3 and Spyder 3.3.4, and cannot find any help in documentation. Vpython website says I should be able to run it:

https://vpython.org/presentation2018/install.html

Avatrin
  • 171
  • 1
  • 15
  • How did you install vpython? What happens if you start Python at the command line and type the above code? – nekomatic May 15 '19 at 13:04
  • I used Anaconda to install Vpython. Running it from the Anaconda Commant Prompt actually works! – Avatrin May 15 '19 at 14:37
  • Try starting Spyder from the Anaconda command prompt. If you didn't install vpython in the base environment, install `spyder-kernels` in the same environment as vpython and `activate` that environment before starting Spyder. – nekomatic May 15 '19 at 15:24
  • Note that the installation info at vpython.org says that in order to use an up-to-date Spyder you MUST install vpython 7.5.0. Execute "conda list vpython" to check that you have vpython 7.5.0. – user1114907 May 19 '19 at 01:10

1 Answers1

2

I had the same issue: I kept getting these "NameError: name 'gsprint' is not defined" error messages when running codes with the from vpython import * line. Strangely, the same codes on Anaconda/Spyder in another computer were working fine.

I ended up in this page while looking for a solution. I tried the simple vpython code above and got the same error message running from spyder while it worked fine running directly in the Anaconda prompt. I checked that the vpython version in the environment is 7.5.0.

My solution: an overall update on Anaconda

conda update --all

I'm now running with Spyder 3.3.6 and Python 3.7.3 and the code is working fine.

DennisLi
  • 3,915
  • 6
  • 30
  • 66
Haldane
  • 21
  • 3