1

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?

7
  • Python (and Linux) is case sensitive. The snippets you give would not work so it's impossible to know what you have actually tried. Perhaps cut&paste the text of the commands you enter and the actual responses.
    – joan
    Commented Sep 4 at 19:18
  • Ok, I've updated the original post with your suggestions, thanks! Commented Sep 4 at 22:02
  • @joan If there is anything in my question that you'd like me to clarify, please let me know. Commented Sep 4 at 22:11
  • This works on x86-64 linux, so I'd guess it has something to do with the openGL implementation on the Pi.
    – goldilocks
    Commented Sep 6 at 19:25
  • @goldilocks I see. Could you please give me some guidance on how I can troubleshoot the webgl implementation? Thank you very much for the reply!! Commented Sep 6 at 20:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.