RobotPy 2021 issue with rev module on roborio

Whenever I try to run a program that imports the rev library on the roborio I get an error message like this one:

    Traceback (most recent call last):
      File "/home/lvuser/test.py", line 1, in <module>
        import rev
      File "/usr/local/lib/python3.9/site-packages/rev/__init__.py", line 3, in <module>
        from . import _init_rev
      File "/usr/local/lib/python3.9/site-packages/rev/_init_rev.py", line 12, in <module>
        import rev._sparkmaxdriver._init_rev_spark_driver
      File "/usr/local/lib/python3.9/site-packages/rev/_sparkmaxdriver/__init__.py", line 1, in <module>
        from . import _init_rev_spark_driver
      File "/usr/local/lib/python3.9/site-packages/rev/_sparkmaxdriver/_init_rev_spark_driver.py", line 14, in <module>
        _lib = cdll.LoadLibrary(join(_root, "lib", "libSparkMaxDriver.so"))
      File "/usr/local/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
        return self._dlltype(name)
      File "/usr/local/lib/python3.9/ctypes/__init__.py", line 374, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: libwpimathjni.so: cannot open shared object file: No such file or directory

Does anyone know how I can fix this?

(You may notice that it is not running the main program and is instead running a file called test.py, this file contains only a single line with import rev)

Well, we knew this affected the macOS libraries, but didn’t notice this was also a problem on the roboRIO. That’s awkward.

There is a workaround solution. Download the following file, and inside in the linux\athena\shared folder there is a libwpimathjni.so file. if you ftp that into /usr/local/frc/third-party/lib on the roborio, it should then run. You might also have to ssh in and run ldconfig

https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpimath/wpimath-cpp/2021.2.1/wpimath-cpp-2021.2.1-linuxathena.zip

This worked, thanks. I did not have to run ldconfig (though its probably because I reset the roborio before I tested if the program was now running).

I’ve found a workaround at build time. robotpy-rev 2021.0.2 should fix this for good (and has the bonus of macOS support too).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.