IDLE Shell 3.12.1 - ModuleNotFoundError: No Module named 'vpython'

Hello everyone.
I am a ‘complete’ newbie to Python having never learned or used it before.
I have donloaded Python 3.12.1 and use the IDLE Shell 3.12.1
I am following a YouTube course on using a BNO055 9-axis IMU by toptechboy where I now need to use Python and in Lessons 12 to 13 need to use vpython to create a visualisation.
Previously from the course I had Index errors but I read up on what that meant in Python and worked out a solution in my code to read the numerical string values coming in from the serial port which I am displaying perfectly.

import serial
import time
pause = 0.0005

while (1==1):
    while (arduinoData.inWaiting()==0):
    n= 6                              #This is the 'size' of the Index Range which is 7 pieces of data
    dataPacket=arduinoData.readline() #Here dataPacket reads the data on the Serial Port   
    splitPacket=dataPacket.split(',') #Here splitPacket has the data Contents and creates an Arraytoptechboy imu lesson 13
    while n < len (splitPacket):
        Acal=  float(splitPacket[0])
        Gcal=  float(splitPacket[1])
        Mcal=  float(splitPacket[2])
        Scal=  float(splitPacket[3])
        Pitch= float(splitPacket[4])
        Roll=  float(splitPacket[5])
        Yaw=   float(splitPacket[6])
        print("Acal=",Acal,"Gcal=",Gcal,"Mcal=",Mcal,"Scal",Scal, "Pitch=",Pitch,"Roll=",Roll,"Yaw=",Yaw)

I followed the lesson instruction using: pip install vpython but the IDLE Shell returns this error:-
Traceback (most recent call last):
File “<pyshell#0>”, line 1, in
import vpython
ModuleNotFoundError: No module named ‘vpython’

When I used pip install vpython it informed me that it had successfully installed?
I ran the Repair Ensure all current features are correctly installed …
and now when I use at the Command Prompt pip install vpython it now say…
C:\Users\derek>pip install vpython
Fatal error in launcher: Unable to create process using ‘“c:\users\derek\appdata\local\programs\python\python37\python.exe” “C:\Users\derek\AppData\Local\Programs\Python\Python37\Scripts\pip.exe” install vpython’: The system cannot find the file specified.

Obviously I’ve broken something as well as having the original problem of vpython???

Any help and advice is warmly appreciated.

I see that you want to use python 3.12.1 but did you notice that the error message from pip is for python 3.7?

I expect that you have configured python 3.7 to be on your PATH.
You could update the PATH to point to python 3.12 or you could use the py.exe command.

For example check what is the version of the default python for py.exe:

py -V

Assuming it is 3.12.1 then run pip this way:

py -m pip install vpython

You might want to uninstalled python 3.7 to avoid complications, useless you need pytohn 3.7 for some reason.


Thank you for the help, I kind of found my way through by un-installing the older Python version and re-installing Python V.3.12.1 which has corrected the PATH.

pip is also working correctly this time. I say ‘correctly’ as at the command prompt pip is coloured text this time where before is wasn’t.
I’ve also successfully downloaded vpython and in the Python IDLE import vpython command worked without any erros.
I’ve also successfully created a simple box and sphere.
I downloaded a vpython .pdf but I really need to follow some simple Tutorials to get me going as the code used in my lessons didn’t work e.g.

from vpython import*
x=box(length=6, width=3, height=0.2)

but I used this code and it works


I feel I’m making progress again in the right direction, and many thanks for your help :slight_smile:

The failure of import vpython had nothing to do with the fact that you are using IDLE’s Shell running on ...Python3.12/python.exe instead of, for instance the standard REPL running on the same python.exe. The latter can be invoked by, for instance, clicking Python 3.12 (##-bits) under Python 3.12 on the Start menu, or by entering py -3.12 in Command Prompt. In either case, the problem would be package vpython not installed for the particular .exe binary. (And the same would be true for any version.) I therefore modified the title.

1 Like