Can't start vpython in VS Code

2,424 views
Skip to first unread message

Jim Kindsvater

unread,
Feb 27, 2022, 11:45:01 PM2/27/22
to VPython-users
Hello all..  I am stymied.  When I try to "import vpython" in VS Code, I get a response as follows:
import vpython
ModuleNotFoundError: No module named 'vpython'

I can enter import python and then run some commands in the CMD window and in IDLE, but not in VS Code.  I run other Python programs in VSC so I know it works, but not VPython.

I've reinstalled Python several times and VS Code too.  I've checked the path list and Python is there.  I even copied the target address from "pip install vpython" and added it to the path, but nothing works.

Does anyone have a suggestion for what I can try?

Thanks, Jim

John

unread,
Feb 28, 2022, 1:35:35 AM2/28/22
to VPython-users
Have a look at this video tutorial on youtube about using VPython in VSCode

Bruce Sherwood

unread,
Feb 28, 2022, 2:44:43 PM2/28/22
to VPython-users
Warning: The simple program the video shows ends with "while True: pass". This works with installed Python outside a notebook but locks up in Jupyter notebook and in Web VPython because the infinite loop without a rate() statement prevents rendering.  It works outside a notebook because the no-notebook case was implemented using threads.

I don't understand why the video has that infinite loop; the presenter says something about it being necessary, which I don't understand.

Bruce

Reply all
Reply to author
Forward
0 new messages