wpilibsuite / WPILibPi

WPILib Raspberry Pi images designed for FRC (formerly FRCVision)
Other
87 stars 40 forks source link

import cv2 fails on python3 on 2020.1.1 #132

Closed kglasnapp closed 4 years ago

kglasnapp commented 4 years ago

I attempted import cv2 on python3 on 2020.1.1 -- the result was file not found.

I did an import cv2 with a 2019.3.1 image and it worked. What am I doing wrong?

PeterJohnson commented 4 years ago

You're not doing anything wrong, looks like a bug in the 2020 beta image.

auscompgeek commented 4 years ago

It looks like the stage3 build does look for Python 3.7 correctly, but the package list includes python3.5 instead of python3.7:

https://github.com/wpilibsuite/FRCVision-pi-gen/blob/657939e6a8a242ddbc06d54745ca30d064c0a00d/stage3/01-sys-tweaks/00-packages#L2-L5

joecaraccio commented 4 years ago

Also experiencing this..we were so confused how the image didn't include cv2.

Does anyone know how to generate a release of the image to be flashed? I spend most of my time on a windows machine so didn't want to deal with setting up all that stuff

PeterJohnson commented 4 years ago

There's an easy patch fix if you don't want to reflash the whole image, just ssh in, make the filesystem writable with rw, and run both cd /usr/local/frc/lib/python3.7/dist-packages/cv2/python-3.7 && sudo mv cv2.cpython-37m-*-gnu.so cv2.cpython-37m-arm-linux-gnueabihf.so && sudo mv cv2d.cpython-37m-*-gnu.so cv2d.cpython-37m-arm-linux-gnueabihf.so and sudo ln -sf /usr/local/frc/lib/python3.7/dist-packages/cv2 /usr/local/lib/python3.7/dist-packages/cv2