Skip to content

JacobiRobot import crashes with NumPy 2.x because matplotlib is imported eagerly #18

Description

@MNikoliCC

Summary

The Webots bridge imports teleop.utils.jacobi_robot.JacobiRobot. That module imports matplotlib.pyplot at module import time, even though the Webots path does not use plotting.

On the current machine, user-site NumPy was upgraded to 2.5.0 while system Matplotlib was compiled against NumPy 1.x. The eager Matplotlib import caused the bridge to crash before any robot logic started.

Observed error

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.5.0
ImportError: numpy.core.multiarray failed to import

Stack:

File ".../webots/controllers/ur3e_teleop_bridge/ur3e_teleop_bridge.py", line 17, in <module>
  from teleop.utils.jacobi_robot import JacobiRobot
File ".../teleop/teleop/utils/jacobi_robot.py", line 3, in <module>
  import matplotlib.pyplot as plt

Expected behavior

Importing JacobiRobot for non-visual servoing should not import Matplotlib.

Acceptance criteria

  • Move matplotlib.pyplot import into the visualization methods that actually use it.
  • from teleop.utils.jacobi_robot import JacobiRobot works without Matplotlib being importable.
  • The Webots bridge starts without requiring a NumPy downgrade solely because of Matplotlib.
  • Add or update a lightweight import test in teleop if practical.

Temporary workaround

Downgrading user-site NumPy to <2 unblocked the local run:

python3 -m pip install --user --break-system-packages "numpy<2"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions