Missing modules when installing on Windows 7

This seems … odd.
I’ve gotten the IDE running on a Windows 7 machine. Everything looks great!

When I tried running the example helloworld script … I’m getting missing module errors (smbus and pyb).
I’m unable to install those using ‘pip -m install’ … any ideas?
My normal python troubleshooting is failing me here.
Thank you!

The python code only runs on the OpenMV Camera.

ok…clearly a misunderstanding on my part then.

Is there a tutorial to run the camera without the IDE?

You just need to copy the script onto the camera and call the script main.py and it should run. The IDE has a button under Tools to do this for you given whatever script you have open. Then you just need to reset the camera and it will run.

… and call the script main.py and it should run…

I think I get how to copy scripts to the camera (the camera is showing up as an external drive…so no having to copy via command line) … so…


But, when I navigated to the removable disk, I got the same message as above:

E:\>dir
 Volume in drive E has no label.
 Volume Serial Number is 3678-CA66

 Directory of E:\

03/25/2007  01:19 AM               247 main.py
03/25/2007  01:19 AM             2,577 openmv.inf
03/25/2007  01:19 AM               551 README.txt
               3 File(s)          3,375 bytes
               0 Dir(s)          73,728 bytes free

E:\>py main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import pyb, time
ModuleNotFoundError: No module named 'pyb'

The Python scripts for OpenMV run on the camera itself not on your PC. The camera has an embedded Python interpreter (called MicroPython) which runs scripts from the file system (flash or SD card). The scripts import modules and call functions that are only available for the camera, for example, pyb is a Python module that controls the board (I/O pins, I2C and so on). The sensor module controls the image sensor (capture an image, set the resolution and so on).

Thanks for the reply!

The Python scripts for OpenMV run on the camera itself not on your PC.

That makes sense (and is what I thought when I was reading the documentation)… what I’m confused on is how to do what was described here:

Ninja EDIT:

I guess what I’m having trouble visualizing is the recommended way to develop/ test/ deploy for this camera system (which looks pretty bad-a, by the way. good job!).
I have used python before… and done some machine vision work.
I think that I would be writing scripts, copying them to the camera’s internal flash, modifying the main script that calls them …
BUT
the testing and visualization bit is where I seem to be stuck (basically the ‘hello world’ idea … and I don’t mean the IDE).
Say I have a script.
I write the script in python to be compatible with the stripped down version used here.
I copy the code to the flash.
Then … how do I “run” it?
How do I visualize the output?

Uh. Yeah :slight_smile:
(like I said in a different post… I’m a newbie and could use some hand-holding here. I’m out of my comfort zone but am doing my best to learn! and as always, thanks for the help!)

I think Kwabena means name the file “main.py” to overwrite the default main.py. Note make sure to safe remove the disk after overwriting the file.

Does the IDE call that directly for use with visualization? Is that what you’re saying?

No, main.py is run by the camera after power up. When the camera is powered up it checks if the main.py file exists, If so the camera runs it, if not the camera just waits for commands or for the IDE.

When the IDE is connected, you can write a script and click execute to run this script. The IDE uploads the script to the cam and tells it to run the script . While the script is running, the IDE keeps reading and displaying the frame buffer .

→ Note you can Not see the frame buffer when the camera is running main.py, because when the IDE is connected it interrupts the running code.

So basically the work flow is:

  • Write a script in the IDE.
  • Click execute/run button.
  • The script runs and you see the frame buffer updated.
  • When you’re satisfied with your script, rename the script to main.py and overwrite the default main.py.
  • Now on the next power up, the cam will run your code instead of the default.

Under the Tools menu in the IDE there’s an option to copy the current script you are working on to the camera. Use this once you are done writing the code in the IDE. Additionally, to reset the camera the IDE also has a reset command under the tools menu too. You have to reset the camera (which disconnects from the IDE) to start running whatever code you wrote. While the IDE is connected it has complete control of the camera.

If you don’t like the IDEs text editor you can manually edit files saved on disk with another editor and the IDE will detect the change and reload the file so you can then execute the script in the IDE.

Ok.

Thank you.
I think I’m starting to understand the workflow.
Is there an ELI5 (explain like I’m five) document somewhere that shows this workflow?
I don’t mind helping put one together if not (it might save the next guy some time!) once I get my head fully around it.

(seriously. y’all are awesome. thanks for the help)

There’s just the tuturial explaining the install process online. I haven’t had time to write a more in-depth tuturial on how to do CV stuff. Right now it’s just kinda figure it out on your own and ask questions.

If you’re interested in writing something up we’ll definitely post it on the main website with your name on it.

My time is spent right now expanding features. If I don’t do this you won’t be able to use the camera for what you need.

What if I want to run the “new” script on the cam without having to power down/ unplugging the camera and without using the IDE?
(for instance, if I were to want to run the script … on the camera … starting it using a command prompt command … something like typing, “E:>>python main.py”)

In this case you just use the IDE to run your script, see for example this video. Note the script won’t be saved on the cam.

Well, I’m having trouble getting the IDE running in my Linux environment (which is a whole 'nother question … ) and am hoping to do it without the IDE if possible. The Linux environment is running on an Odroid (which is ARM based) and has issues with… things. (by the way, I’m doing a search through the forum … is there a thread where someone streams the “video”/still images without using the IDE? That would be an interesting read)

Yeah I remember. If you open the serial port (/dev/ttyACMx) you’ll get a Python command prompt, and you can run commands one by one (and even read back images over serial) or you could try to send full scripts with something like cutecom. The problem is you won’t be able to view the frame buffer, because there’s No GUI to display images, unless you code something custom to display the images (like something with pygame + pyserial).

Using the IDE is really the easiest way to go, if you must use the ARM-based board, maybe see if there’s an x86 emulator ?