在docker里运行rosbag,安装ros后还不行,还得安装一些支持包。
需要使用python3读写rosbag时,环境里一般需要安装yaml、pycryptodomex、gnupg、rospkg等常用包,否则报错,其中报这个错误时:
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in
from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 53, in
from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'
安装pycryptodome还不行,得安装pycryptodomex才能解决。
详细记录:
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Traceback (most recent call last):
File "main.py", line 14, in
from src import ExtractOdSegData
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 16, in
import rosbag
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in
from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 51, in
import yaml
ModuleNotFoundError: No module named 'yaml'
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# pip3 install pyyaml
Collecting pyyaml
Downloading https://files.pythonhosted.org/packages/b3/85/79b9e5b4e8d3c0ac657f4e8617713cca8408f6cdc65d2ee6554217cedff1/PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (603kB)
100% |████████████████████████████████| 604kB 2.5MB/s
Installing collected packages: pyyaml
Successfully installed pyyaml-6.0
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Traceback (most recent call last):
File "main.py", line 14, in
from src import ExtractOdSegData
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 16, in
import rosbag
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in
from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 53, in
from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# pip3 install pycryptodome -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Collecting pycryptodome
Downloading http://mirrors.aliyun.com/pypi/packages/79/71/ced0ee573f4c0ff7832306fe79dea782f0dd058145ad1a5f443eefd2ccb3/pycryptodome-3.16.0-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.3MB)
100% |████████████████████████████████| 2.3MB 652kB/s
Installing collected packages: pycryptodome
Successfully installed pycryptodome-3.16.0
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Traceback (most recent call last):
File "main.py", line 14, in
from src import ExtractOdSegData
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 16, in
import rosbag
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in
from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 53, in
from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# pip3 install pycryptodomex -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Collecting pycryptodomex
Downloading http://mirrors.aliyun.com/pypi/packages/76/dd/7276f37251f84931bd97bb42fe10455cad782dcb9a38b9820f65d2a098e8/pycryptodomex-3.16.0-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.3MB)
100% |████████████████████████████████| 2.3MB 641kB/s
Installing collected packages: pycryptodomex
Successfully installed pycryptodomex-3.16.0
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Traceback (most recent call last):
File "main.py", line 14, in
from src import ExtractOdSegData
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 16, in
import rosbag
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in
from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 56, in
import gnupg
ModuleNotFoundError: No module named 'gnupg'
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# pip3 install gnupg -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Collecting gnupg
Downloading http://mirrors.aliyun.com/pypi/packages/96/6c/21f99b450d2f0821ff35343b9a7843b71e98de35192454606435c72991a8/gnupg-2.3.1.tar.gz (100kB)
100% |████████████████████████████████| 102kB 609kB/s
Collecting psutil>=1.2.1 (from gnupg)
Downloading http://mirrors.aliyun.com/pypi/packages/3d/7d/d05864a69e452f003c0d77e728e155a89a2a26b09e64860ddd70ad64fb26/psutil-5.9.4.tar.gz (485kB)
100% |████████████████████████████████| 491kB 599kB/s
Building wheels for collected packages: gnupg, psutil
Running setup.py bdist_wheel for gnupg ... done
Stored in directory: /root/.cache/pip/wheels/8d/e4/fd/11e94cc0552705176a48f02aa1db2f0e94fc8adc6d075c7fc3
Running setup.py bdist_wheel for psutil ... done
Stored in directory: /root/.cache/pip/wheels/88/da/93/211a7200309819d3dc95c4019ee2c1c3372915d9afb9546f19
Successfully built gnupg psutil
Installing collected packages: psutil, gnupg
Successfully installed gnupg-2.3.1 psutil-5.9.4
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Traceback (most recent call last):
File "main.py", line 14, in
from src import ExtractOdSegData
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 16, in
import rosbag
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in
from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 68, in
import roslib.names # still needed for roslib.names.canonicalize_name()
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in
from roslib.launcher import load_manifest # noqa: F401
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in
import rospkg
ModuleNotFoundError: No module named 'rospkg'
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# pip3 install rospkg -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Collecting rospkg
Downloading http://mirrors.aliyun.com/pypi/packages/9b/be/70454d42c1a8f670385d6b679ca672102a4e3b9ecfb4ed922ea9ba19b9ab/rospkg-1.4.0-py3-none-any.whl
Requirement already satisfied: PyYAML in /usr/local/lib/python3.6/dist-packages (from rospkg)
Collecting catkin-pkg (from rospkg)
Downloading http://mirrors.aliyun.com/pypi/packages/d7/52/a5395120c9a9a92837d7daf28c4fd26df50ed6e291244c70fef1a1caa5c2/catkin_pkg-0.5.2-py3-none-any.whl (76kB)
100% |████████████████████████████████| 81kB 675kB/s
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from catkin-pkg->rospkg)
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.6/dist-packages (from catkin-pkg->rospkg)
Requirement already satisfied: pyparsing in /usr/local/lib/python3.6/dist-packages (from catkin-pkg->rospkg)
Collecting docutils (from catkin-pkg->rospkg)
Downloading http://mirrors.aliyun.com/pypi/packages/8d/14/69b4bad34e3f250afe29a854da03acb6747711f3df06c359fa053fae4e76/docutils-0.18.1-py2.py3-none-any.whl (570kB)
100% |████████████████████████████████| 573kB 512kB/s
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil->catkin-pkg->rospkg)
Installing collected packages: docutils, catkin-pkg, rospkg
Successfully installed catkin-pkg-0.5.2 docutils-0.18.1 rospkg-1.4.0
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
Traceback (most recent call last):
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 22, in
from typing import TypedDict
ImportError: cannot import name 'TypedDict'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 14, in
from src import ExtractOdSegData
File "/workspace/ExtractOdData_gen_RSU_data/src/ExtractOdSegData.py", line 24, in
from typing_extensions import TypedDict
ModuleNotFoundError: No module named 'typing_extensions'
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# pip3 install typing_extensions -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Collecting typing_extensions
Downloading http://mirrors.aliyun.com/pypi/packages/45/6b/44f7f8f1e110027cf88956b59f2fad776cca7e1704396d043f89effd3a0e/typing_extensions-4.1.1-py3-none-any.whl
Installing collected packages: typing-extensions
Successfully installed typing-extensions-4.1.1
root@fychen-G7-7700:/workspace/ExtractOdData_gen_RSU_data# python3 main.py --step ExtractOdData
Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
-------------------------------------------------------
Processing: README.md
-------------------------------------------------------
Processing: config_init
-------------------------------------------------------
Failed to load Python extension for LZ4 support这个的错误的原因是python3下没有LZ4压缩算法包只有python2下才有,所以要么bag里不要用LZ4压缩数据,要么代码用纯python2实现。