robotpy / robotpy-cscore

Moved to https://github.com/robotpy/mostrobotpy
Other
18 stars 12 forks source link

NumPy error on RoboRIO #11

Closed czhao39 closed 7 years ago

czhao39 commented 7 years ago

I am able to deploy my camera code successfully (from Linux), but on the RoboRIO, I get the following error in the Driver Station:

File "/home/lvuser/py/camera.py", line 4, in \<module> import cv2 ImportError: numpy.core.multiarray failed to import

Searching through Google, it seems that the source of this error is usually having multiple versions of NumPy installed. However, I ran find -name numpy from the root of the RoboRIO and I only have NumPy 1.12.0 installed. I installed it by running robotpy-installer download-opkg python36-numpy.

virtuald commented 7 years ago

Hm. I haven't tried it on a fresh RoboRIO yet. That bug really should be filed over at roborio-packages too. Let me try it real quick on my VM.

virtuald commented 7 years ago

Works for me. What version of OpenCV did you install?

czhao39 commented 7 years ago

That's odd. I used the installer (robotpy-installer install-opkg opencv3-dev and robotpy-installer install-opkg python36-opencv3).

czhao39 commented 7 years ago

If it worked for you, maybe I'll just try reinstalling everything tomorrow. Is there a convenient way to reinstall opkg packages installed with robotpy-installer?

virtuald commented 7 years ago

I assume you have the 2017 RoboRIO image installed? If you haven't updated, that could cause issues.

Let me know how it goes.

czhao39 commented 7 years ago

Thanks! I do have the 2017 image installed. I'll let you know how it goes tomorrow.

czhao39 commented 7 years ago

Well, the error magically went way after a restart (I should've thought of that). But now I get the following error:

camera = cs.UsbCamera("usbcam", port) AttributeError: module 'cscore' has no attribute 'UsbCamera'

Since the RoboRIO is running Linux, will the UsbCamera class eventually be supported, or will we have to use OpenCV instead as you described in the readme? I got cscore with robotpy-installer install-opkg python36-robotpy-cscore.

virtuald commented 7 years ago

cscore is still a preview release (any day now!), so there are still bugs. I expect UsbCamera to work on the RIO.

czhao39 commented 7 years ago

Okay, thanks! Just to let you know, it seems like cscore doesn't actually have any classes, not just UsbCamera. I ran help(cs) and got the following output (no package contents):

Help on package cscore:

NAME cscore

PACKAGE CONTENTS

FILE /home/lvuser/py/cscore/init.py

auscompgeek commented 7 years ago

@czhao39 It looks like you've somehow have an empty cscore/__init__.py in your code. That'll override the real cscore, which should be installed in /usr/local/lib/python3.6/site-packages/cscore, I believe.

FWIW, my team have been using cscore just fine on a roboRIO.

virtuald commented 7 years ago

@czhao39 did you compile it yourself or install the ipk I uploaded? Maybe it's broken. Either way, I'm trying to get it done soon.

czhao39 commented 7 years ago

I'm sorry, @auscompgeek was right. I just realized I completely forgot to delete the dummy cscore module I made in Windows for testing, which I didn't have in Linux. That was really dumb. I'll try again on Thursday and see if the NumPy error persists. Also, thanks for everything you've done / are doing!