Found an issue in which the ROS versions of matplotlib (installed via rosdep/apt) can conflict with pip installed versions -- specifically for the mpl_toolkits.mplot3d.axes3d module.
/usr/local/lib/python3.12/dist-packages/matplotlib/projections/__init__.py:63:
UserWarning: Unable to import Axes3D.
This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package).
As a result, the 3D projection is not available.
...
File "/delib_ws/build/pyrobosim/pyrobosim/manipulation/grasping.py", line 9, in <module>
from mpl_toolkits.mplot3d import Axes3D
File "/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py", line 1, in <module>
from .axes3d import Axes3D
File "/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 35, in <module>
from matplotlib.tri.triangulation import Triangulation
ModuleNotFoundError: No module named 'matplotlib.tri.triangulation'
So to be a bit safer, I'm moving these imports inside the 2 functions that actually use them.
Found an issue in which the ROS versions of matplotlib (installed via
rosdep
/apt
) can conflict withpip
installed versions -- specifically for thempl_toolkits.mplot3d.axes3d
module.So to be a bit safer, I'm moving these imports inside the 2 functions that actually use them.