leggedrobotics / elevation_mapping_cupy

Elevation Mapping on GPU.
MIT License
521 stars 114 forks source link

error about simple_parsing #88

Closed crankler closed 6 months ago

crankler commented 6 months ago

Hello, thank you for your teams work, it's really helpful. However, when I run this command `roslaunch elevation_mapping_cupy turtlesim_simple_example.launch in the terminal, I got this error :

terminate called after throwing an instance of 'pybind11::error_already_set'
  what():  ModuleNotFoundError: No module named 'simple_parsing'

At:
  /home/yc/catkin_map/catkin_eth_cupy/src/elevation_mapping_cupy/elevation_mapping_cupy/script/elevation_mapping_cupy/parameter.py(8): <module>
  <frozen importlib._bootstrap>(219): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(848): exec_module
  <frozen importlib._bootstrap>(686): _load_unlocked
  <frozen importlib._bootstrap>(975): _find_and_load_unlocked
  <frozen importlib._bootstrap>(991): _find_and_load
  /home/yc/catkin_map/catkin_eth_cupy/src/elevation_mapping_cupy/elevation_mapping_cupy/script/elevation_mapping_cupy/__init__.py(1): <module>
  <frozen importlib._bootstrap>(219): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(848): exec_module
  <frozen importlib._bootstrap>(686): _load_unlocked
  <frozen importlib._bootstrap>(975): _find_and_load_unlocked
  <frozen importlib._bootstrap>(991): _find_and_load
  <frozen importlib._bootstrap>(219): _call_with_frames_removed
  <frozen importlib._bootstrap>(961): _find_and_load_unlocked
  <frozen importlib._bootstrap>(991): _find_and_load

I have install simple_parsing with pip, but the error still exists. I still don't know the reason. So do you know how to fix it? Thanks you for your reply.

georgflick commented 6 months ago

You just need to install the package with pip install simple-parsing and not with --user. The package should be then here: /usr/local/lib/python3.8/dist-packages/simple_parsing

crankler commented 6 months ago

Tkank you for your help. However, it still doesn't wrok. When I input this command:

Requirement already satisfied: simple_parsing in /home/yc/.local/lib/python3.11/site-packages (0.1.5)
Requirement already satisfied: docstring-parser~=0.15 in /home/yc/.local/lib/python3.11/site-packages (from simple_parsing) (0.15)
Requirement already satisfied: typing-extensions>=4.5.0 in /home/yc/anaconda3/lib/python3.11/site-packages (from simple_parsing) (4.9.0)

and when I launch the file, the error shows here:

terminate called after throwing an instance of 'pybind11::error_already_set'
  what():  ModuleNotFoundError: No module named 'simple_parsing'

At:
  /home/yc/catkin_map/catkin_eth_cupy/src/elevation_mapping_cupy/elevation_mapping_cupy/script/elevation_mapping_cupy/parameter.py(8): <module>
  <frozen importlib._bootstrap>(219): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(848): exec_module
  <frozen importlib._bootstrap>(686): _load_unlocked
  <frozen importlib._bootstrap>(975): _find_and_load_unlocked
  <frozen importlib._bootstrap>(991): _find_and_load
  /home/yc/catkin_map/catkin_eth_cupy/src/elevation_mapping_cupy/elevation_mapping_cupy/script/elevation_mapping_cupy/__init__.py(1): <module>
  <frozen importlib._bootstrap>(219): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(848): exec_module
  <frozen importlib._bootstrap>(686): _load_unlocked
  <frozen importlib._bootstrap>(975): _find_and_load_unlocked
  <frozen importlib._bootstrap>(991): _find_and_load
  <frozen importlib._bootstrap>(219): _call_with_frames_removed
  <frozen importlib._bootstrap>(961): _find_and_load_unlocked
  <frozen importlib._bootstrap>(991): _find_and_load

By the way, I use the Ubuntu20.04, cuda 12.4, ros-notetic

georgflick commented 6 months ago

seems like you installed it with --user, so you have to uninstall it first, and reinstall it without the --user flag.

pip uninstall simple-parsing typing-extensions docstring-parser and then install it again with pip install simple-parsing should fix the problem.

crankler commented 6 months ago

Yes, when I use conda with python3.8, I reinstall simple-parsing, and it works. Thanks again for your quick reply here.

crankler commented 6 months ago

Hi, @georgflick. Sorry again to bother you, when I launch roslaunch elevation_mapping_cupy turtlesim_semantic_pointcloud_example.launch and roslaunch elevation_mapping_cupy turtlesim_semantic_image_example.launch, there also shows another error:

Traceback (most recent call last):
  File "/home/yc/catkin_map/catkin_eth/devel/lib/semantic_sensor/pointcloud_node.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/yc/catkin_map/catkin_eth/src/elevation_mapping_cupy/sensor_processing/semantic_sensor/script/semantic_sensor/pointcloud_node.py", line 5, in <module>
    import cupy as cp
  File "/home/yc/.local/lib/python3.8/site-packages/cupy/__init__.py", line 31, in <module>
    import cupyx as _cupyx  # NOQA
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/__init__.py", line 8, in <module>
    from cupyx import linalg  # NOQA
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/linalg/__init__.py", line 2, in <module>
    from cupyx.linalg import sparse  # NOQA
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/linalg/sparse/__init__.py", line 3, in <module>
    from cupyx.linalg.sparse._solve import lschol  # NOQA
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/linalg/sparse/_solve.py", line 7, in <module>
    from cupyx.scipy import sparse
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/scipy/__init__.py", line 4, in <module>
    from cupyx.scipy.sparse._base import spmatrix as _spmatrix
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/scipy/sparse/__init__.py", line 1, in <module>
    from cupyx.scipy.sparse._base import issparse  # NOQA
  File "/home/yc/.local/lib/python3.8/site-packages/cupyx/scipy/sparse/_base.py", line 10, in <module>
    import scipy.sparse as _sparse
  File "/usr/lib/python3/dist-packages/scipy/sparse/__init__.py", line 229, in <module>
    from .base import *
  File "/usr/lib/python3/dist-packages/scipy/sparse/base.py", line 8, in <module>
    from .sputils import (isdense, isscalarlike, isintlike,
  File "/usr/lib/python3/dist-packages/scipy/sparse/sputils.py", line 16, in <module>
    supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
  File "/usr/lib/python3/dist-packages/scipy/sparse/sputils.py", line 16, in <listcomp>
    supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
  File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 320, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'typeDict'
qt5ct: D-Bus global menu: no
[ INFO] [1710222817.397414925]: pointcloud_channel_fusion_dict: {'default': 'average', 'rgb': 'color'}
[ INFO] [1710222817.397842233]: image_channel_fusion_dict: {'default': 'exponential', 'rgb': 'color'}
[front_cam-5] process has died [pid 53286, exit code 1, cmd /home/yc/catkin_map/catkin_eth/devel/lib/semantic_sensor/pointcloud_node.py front_cam __name:=front_cam __log:=/home/yc/.ros/log/ddcf14ca-e034-11ee-a3c2-cb8a5cce1b46/front_cam-5.log].
log file: /home/yc/.ros/log/ddcf14ca-e034-11ee-a3c2-cb8a5cce1b46/front_cam-5*.log

I think it is caused by cupy where I found "File "/usr/lib/python3/dist-packages/scipy/sparse/sputils.py", line 16, in ", but in conda where python is 3.8, I install pip install scipy==1.8, I found:

Requirement already satisfied: scipy==1.8 in /home/yc/.conda/envs/torch38/lib/python3.8/site-packages (1.8.0)
Requirement already satisfied: numpy<1.25.0,>=1.17.3 in /home/yc/.conda/envs/torch38/lib/python3.8/site-packages (from scipy==1.8) (1.21.1)

I means these two installion positon of scipy are not same, and I keep fix this dismatch issue here.

crankler commented 6 months ago

I've solve this issue, just install the commands:

sudo pip3 install simple_parsing
sudo pip3 install numpy==1.21.1
sudo apt-get install ros-noetic-ros-nump

I can launch both command in bash.