ev3dev / vscode-ev3dev-browser

Visual Studio Code extension for browsing ev3dev devices
https://marketplace.visualstudio.com/items?itemName=ev3dev.ev3dev-browser
MIT License
39 stars 11 forks source link

ModuleNotFoundError: No module named 'pybricks' error with ev3 stretch #98

Closed jaffarspace closed 4 years ago

jaffarspace commented 4 years ago

Image file: ev3dev-stretch-ev3-generic-2019-10-23

Describe the bug Followed the steps here [https://www.ev3dev.org/docs/getting-started/] (url) I have downloaded and flashed my brick with ev3dev-stretch

When I try to run the below sample code. I'm getting this error

Error

3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 01:54:44) [MSC v.1916 64 bit (AMD64)]
Traceback (most recent call last):
  File "c:/dev/ev3First/ev3First/main.py", line 31, in <module>
    from pybricks import ev3brick as brick
ModuleNotFoundError: No module named 'pybricks'

Code

#!/usr/bin/env pybricks-micropython

from pybricks import ev3brick as brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
                                 InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Button, Color,
                                 SoundFile, ImageFile, Align)
from pybricks.tools import print, wait, StopWatch
from pybricks.robotics import DriveBase

brick.sound.beep()

Desktop (please complete the following information):

Additional context I think I'm mixing python versions, but not sure how to resolve. Am I supposed to use ev3micropythonv100sdcardimage-4b8c8333736fafa1977ee7accbd3338f download. I thought Python3 would recognize micropython pybricks library? Am i confused with ev3dev with ev3 micropython?

Appreciate your help on this.

Also bluetooth connection always resets to dynamic ip address and I had to read the ipaddress from brick and input in VS Code Command Pallet every time. Is there any other way to workaround it?

dlech commented 4 years ago

It looks like you are trying to run the program on your computer instead of on the EV3. This doesn't work. You can only run it on the EV3.

dlech commented 4 years ago

And yes, you need to download the SD card image from LEGO Education to get Pybricks.

pythoncader commented 4 years ago

Can you get help on pybricks library? Since the Pybricks library isn't recognized within vscode, how would I install pybricks on my computer? Thank you

dlech commented 4 years ago

how would I install pybricks on my computer?

See https://github.com/pybricks/support/issues/10#issuecomment-609060042

pythoncader commented 4 years ago

Thanks for the quick response!

ShehramTahir commented 4 years ago

@dlech can you please guide me about the same issue.

my test.py file is running successfully and lego is performing test code activity but when I run "main.py" file it doesn't give me any error running "python3 main.py " but when I run it on lego it gives same error that "no module name ''pybricks.hubs

1

"