While trying to make a model of a red ball via vpython, I encountered an issue on my raspberry pi 5. I installed vpython like this: pip install vpython
But when I ran this an error occurred:
error: externally-managed-environment
This environment is externally managed
hint: See PEP 668 for the detailed specification.
python -m venv myenv
source myenv/bin/activate
Again, I used pip to install vpython and it worked.
Next I created a script like so:
nano vp.py
Then inside the script I wrote:
from vpython import sphere, color
shape = sphere(radius = 2, color=color.red)
And then I ran my script with: python3 vp.py
This created a new tab in my browser with a note open. I waited a few minutes, but the note remained black, and the expected red ball did not emerge. I tried again, unsuccessfully.
I then tried this via the python shell:
from vpython import *
ball = sphere(radius=2,color=color.red)
The same unsuccessful result occurred.
To double check that my browser could render 3d objects, I went to the get.webgl.org, to check whether the 3d test object would render. It worked perfectly, so now I know that my device can render objects, but for some reason not vpython ones.
I also tried using some sleep times in case the program was cancelling before the image could be rendered. That didn’t work. After that I tried using the rate()
function. I did this by adding:
from vpython import *
while True:
ball = sphere(radius=2,color=color.red)
rate(100)
Nothing changed. Next, I tried to use a different browser (firefox) instead of chrome (which I was previously using.) The 3d sketch note opened in a firefox tab but still, it remained blank.
When I do the same in the windows terminal, it works as expected.
Do you know what might be causing this issue?