vpython 7.6.5 Installed on MacBook Pro With Sonoma 14.5 OS but Can't See It

29 views
Skip to first unread message

Roger

unread,
May 26, 2024, 12:31:50 PMMay 26
to VPython-users
I have python 3.12.3 installed by brew and can access it by entering python3 in a terminal.
I used pipx to install vpython and it says "installed package vpython 7.6.5, installed using Python 3.12.3"
I want to access vpython from python but can't figure out how to do that.
What I tried below from a new Terminal window didn't work. I probably need to set a path variable somewhere, but I can't even find vpython 7.6.5. so don't know where to start. Any ideas?

>>> from vpython import *

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

ModuleNotFoundError: No module named 'vpython'

>>> from vpython3 import *

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

ModuleNotFoundError: No module named 'vpython3'





Roger

unread,
May 26, 2024, 4:42:46 PMMay 26
to VPython-users
I found the path to vpython, ~/.local/pipx/venvs/vpython, and ~/.local/pipx/venvs/vpython/bin contains the files listed below. I don't see vpython in this list. What should I be importing into python?

Activate.ps1 jsonpointer jupyter-lab jupyter-troubleshoot qtpy
activate jsonschema jupyter-labextension jupyter-trust send2trash
activate.csh jupyter jupyter-labhub normalizer wamp
activate.fish jupyter-console jupyter-migrate pybabel wsdump
f2py jupyter-dejavu jupyter-nbconvert pygmentize xbrnetwork
httpx jupyter-events jupyter-notebook pyjson5 xbrnetwork-ui
ipython jupyter-execute jupyter-qtconsole python
ipython3 jupyter-kernel jupyter-run python3
jlpm jupyter-kernelspec jupyter-server python3.12

John

unread,
May 26, 2024, 5:23:59 PMMay 26
to VPython-users
You mentioned that you installed vpython using brew, so you should be able to list the python packages installed on your computer with the command from the terminal

brew list

or 

brew list vpython

You can create a file called test.py with the following 
 lines

from vpython import *
box()
while True:
    rate(30)
 

then from the terminal type

python3 test.py 

and see a 3D box appear in your browser window.

Here are a bunch of example webvpython programs you can try running on your machine by clicking on "Run" and then click "View" to view the source code. 


You can execute the code using your installed python by copying the source code to a local file on your machine and replacing the first line

Web VPython 3.2

with 

from vpython import *

and saving the file and running it with the command.

python3 filename.py

John

Roger

unread,
May 26, 2024, 6:31:47 PMMay 26
to VPython-users
There is something screwy with MacOS. While I installed python with brew, I'm not able to install vpython with brew. I had to install it using pipx. When I do pipx list I get the results shown below pipx list below. Notice it says package vpython 7.6.5, installed using Python 3.12.3. If that is correct, somehow I need to make something aware of its presence. I did the example text.py file you suggested and get the error:

python3 test.py

Traceback (most recent call last):
File "~/Desktop/test.py", line 1, in <module>
from vpython import *

ModuleNotFoundError: No module named 'vpython'

pipx list
venvs are in ~/.local/pipx/venvs
apps are exposed on your $PATH at ~/.local/bin
manual pages are exposed at ~/.local/share/man
package manim-voiceover 0.3.6.post0, installed using Python 3.12.3
- manim_render_translation
- manim_translate

package vpython 7.6.5, installed using Python 3.12.3
- f2py
- httpx
- ipython
- ipython3
- jlpm
- jsonpointer
- jsonschema
- jupyter
- jupyter-console
- jupyter-dejavu
- jupyter-events
- jupyter-execute
- jupyter-kernel
- jupyter-kernelspec
- jupyter-lab
- jupyter-labextension
- jupyter-labhub
- jupyter-migrate
- jupyter-nbconvert
- jupyter-notebook
- jupyter-qtconsole
- jupyter-run
- jupyter-server
- jupyter-troubleshoot
- jupyter-trust
- normalizer
- pybabel
- pygmentize
- pyjson5
- qtpy
- send2trash
- wamp
- wsdump
- xbrnetwork
- xbrnetwork-ui
- man1/ipython.1

John

unread,
May 26, 2024, 8:18:58 PMMay 26
to VPython-users
The vpython installation instructions are here.


Probably best to use pip install or conda install.

John

unread,
May 26, 2024, 8:46:58 PMMay 26
to VPython-users
Here is some information on the difference between pip install and brew install. Have a look at the recommended answer.


vpython gets released to pypi.org and conda


Roger

unread,
May 27, 2024, 11:20:37 AMMay 27
to VPython-users
Thanks everyone, the problem has been solved. My python path information was set to point to python 3.11 instead of python 3.12.3. 
Once I figured out how to fix this from Jan Meppe https://www.janmeppe.com/blog/how-to-set-python3-as-default-mac/ I was able to use pip to install vpython instead of using pipx, which apparently doesn't do what is claimed.

Reply all
Reply to author
Forward
0 new messages