Closed GPrathap closed 5 months ago
@GPrathap could you please post the full log of the error?
Asking because we have seen cases where the underlying error, visible in the full log, actually indicated an issue with Matplotlib. For example, the error in those cases would look like below, with the first sentence pointing us to the root cause, which was eventually tracked down to conflicting installations of python3-matplotlib
and matplotlib
.
I am curious what we might see in your case.
/usr/local/lib/python3.10/dist-packages/matplotlib/projections/__init__.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being install
ed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available.
warnings.warn("Unable to import Axes3D. This may be due to multiple versions of "
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/dist-packages/spatialmath/__init__.py", line 3, in <module>
from spatialmath.pose2d import SO2, SE2
File "/usr/local/lib/python3.10/dist-packages/spatialmath/pose2d.py", line 26, in <module>
import spatialmath.base as smb
File "/usr/local/lib/python3.10/dist-packages/spatialmath/base/__init__.py", line 8, in <module>
from spatialmath.base.transforms3d import * # lgtm [py/polluting-import]
File "/usr/local/lib/python3.10/dist-packages/spatialmath/base/transforms3d.py", line 48, in <module>
from spatialmath.base.graphics import plotvol3, axes_logic
ImportError: cannot import name 'plotvol3' from 'spatialmath.base.graphics' (/usr/local/lib/python3.10/dist-packages/spatialmath/base/graphics.py)
@jcao-bdai
I am trying to run https://github.com/kidpaul94/IK-MPC
Here is the full log
/home/op/.local/lib/python3.10/site-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.
warnings.warn("Unable to import Axes3D. This may be due to multiple versions of "
Traceback (most recent call last):
File "/home/op/tmp/IK-MPC/MPC_trajectory_following.py", line 5, in
Can you know how you solved it?
Thank you for confirming! Unfortunately I am not aware of a solution yet - the conflict is between python3-matplotlib (installed as part of ROS) and the matplotlib (pip installed).
There was a workaround - DISCLAIMER: this is a hacky workaround, it is not a recommendation from spatialmath-python, please be aware of the hacky nature and only try it if you are willing to take the risk that it may break your workflow.
sudo apt-get remove python3-matplotlib
# later on if you need to apt install packages, you will likely get:
# E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
# doing that will unfortunately bring back python3-matplotlib.
# Again, this is very hacky.
Please feel free to look for a more appropriate solution and kindly share when you do.
Yeap it works, thank youuu,
ImportError: cannot import name 'plotvol3' from 'spatialmath.base.graphics' (/home/op/.local/lib/python3.10/site-packages/spatialmath/base/graphics.py)
I can see plotvol3 is there in the graphics.py, but keep getting this error