fishros / ros2bag_convert

Convert ROS2 bag files to CSV, JSON, etc.
MIT License
62 stars 25 forks source link

ros2bag-convert ModuleNotFoundError #10

Open benjinne opened 8 months ago

benjinne commented 8 months ago

When running the command I keep getting:

Traceback (most recent call last):
  File "/usr/local/bin/ros2bag-convert", line 5, in <module>
    from ros2bag_convert.main import main
ModuleNotFoundError: No module named 'ros2bag_convert.main'

The executable exists under /usr/local/bin and it successfully installed with sudo pip install ros2bag-convert

sudo pip3 install ros2bag_convert
Collecting ros2bag_convert
  Using cached ros2bag_convert-0.1.0-py3-none-any.whl (9.9 kB)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from ros2bag_convert) (59.6.0)
Installing collected packages: ros2bag_convert
Successfully installed ros2bag_convert-0.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Does anyone have any suggestions?

HYD-PG commented 8 months ago

It is possible that your ros2bag_convert is empty, you can go into usr/local/bin to see if the attribute is 0. This situation may be caused by the network, you can re-download it in a better network conditions

sudo pip uninstall ros2bag_convert
sudo pip install ros2bag_convert

Of course, if you still encounter similar alarm errors, you can choose to set up a virtual environment, but you will need to re-download the relevant modules for python3 in order to get ros2bag_convert to run, though it is more cumbersome:

python3 -m venv myenv
source myenv/bin/activate
pip install ros2bag_convert
deactivate

The cost of this is that you may need to re-download modules such as numpy in your virtual environment. This is just a related situation I encountered, I uninstalled and reinstalled and it solved it, hope this helps!