0

我的主机运行的是 Ubuntu 18.04,通过它我设置了一个运行 Ubuntu 20.04 的 LXC 容器。ROS2 安装在容器内,我按照 ROS2 教程使用了很多次,一切正常。

然后我需要安装 OpenCV 和 Dlib,为此我安装了 miniconda。现在我可以使用 OpenCV。

现在问题出在这里:

ubuntu@rosfoxy:~$ . install/setup.bash
bash: install/setup.bash: No such file or directory
ubuntu@rosfoxy:~$ ros2 run py_pubsub talker
Package 'py_pubsub' not found

这两个命令,即使我不完全知道它们的作用,昨天也解决了我的问题

colcon build --cmake-clean-cache # reset python3 env
colcon build --symlink-install # rebuild

今天,他们返回一个巨大的错误消息,结尾是:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.8/distutils/core.py", line 215, in run_setup
    exec(f.read(), g)
  File "<string>", line 14, in <module>
ModuleNotFoundError: No module named 'ruamel_yaml'
[50.668s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'miniconda3/pkgs/ruamel_yaml-0.15.87-py38h7b6447c_1/info/recipe': Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup(    'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {    key: value for key, value in dist.__dict__.items()     if (        not key.startswith('_') and         not callable(value) and         key not in skip_keys and         key not in dist.display_option_names    )};data['metadata'] = {    k: v for k, v in dist.metadata.__dict__.items()     if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 143, in _identify
    retval = extension.identify(_reused_descriptor_instance)
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 48, in identify
    config = get_setup_information(setup_py)
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information
    _setup_information_cache[hashable_env] = _get_setup_information(
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 281, in _get_setup_information
    result = subprocess.run(
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup(    'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {    key: value for key, value in dist.__dict__.items()     if (        not key.startswith('_') and         not callable(value) and         key not in skip_keys and         key not in dist.display_option_names    )};data['metadata'] = {    k: v for k, v in dist.metadata.__dict__.items()     if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1.

[52.228s] ERROR:colcon:colcon build: Duplicate package names not supported:
- cmake_build_test:
  - miniconda3/pkgs/libopencv-4.5.1-py38h703c3c0_0/info/recipe
  - miniconda3/pkgs/libopencv-4.5.1-py38h703c3c0_0/info/test
  - miniconda3/pkgs/opencv-4.5.1-py38h578d9bd_0/info/recipe/parent
  - miniconda3/pkgs/opencv-4.5.1-py38h578d9bd_0/info/test
  - miniconda3/pkgs/py-opencv-4.5.1-py38h81c977d_0/info/recipe/parent
- foobar:
  - miniconda3/pkgs/python-3.8.5-h7579374_1/info/recipe/tests/distutils
  - miniconda3/pkgs/python-3.8.5-h7579374_1/info/test/tests/distutils
  - miniconda3/pkgs/python-3.8.8-hdb3f193_4/info/recipe/tests/distutils
  - miniconda3/pkgs/python-3.8.8-hdb3f193_4/info/test/tests/distutils
- fortomp:
  - miniconda3/pkgs/_openmp_mutex-4.5-1_gnu/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/ld_impl_linux-64-2.33.1-h53a641e_7/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libgcc-ng-9.1.0-hdf63c60_0/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libgcc-ng-9.3.0-h2828fa1_18/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libgfortran-ng-9.3.0-hff62375_18/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libgfortran5-9.3.0-hff62375_18/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libgomp-9.3.0-h2828fa1_18/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libstdcxx-ng-9.1.0-hdf63c60_0/info/recipe/parent/tests/fortomp
  - miniconda3/pkgs/libstdcxx-ng-9.3.0-h6de172a_18/info/recipe/parent/tests/fortomp
- greet:
  - miniconda3/pkgs/python-3.8.5-h7579374_1/info/recipe/tests/distutils.cext
  - miniconda3/pkgs/python-3.8.5-h7579374_1/info/test/tests/distutils.cext
  - miniconda3/pkgs/python-3.8.8-hdb3f193_4/info/recipe/tests/distutils.cext
  - miniconda3/pkgs/python-3.8.8-hdb3f193_4/info/test/tests/distutils.cext
- module_to_install_in_editable_mode:
  - miniconda3/pkgs/conda-4.9.2-py38h06a4308_0/info/test/tests/conda_env/support/advanced-pip/module_to_install_in_editable_mode
  - miniconda3/pkgs/conda-4.9.2-py38h578d9bd_0/info/test/tests/conda_env/support/advanced-pip/module_to_install_in_editable_mode
- my-test-package:
  - miniconda3/envs/py38/lib/python3.8/site-packages/pkg_resources/tests/data/my-test-package-source
  - miniconda3/pkgs/setuptools-52.0.0-py38h06a4308_0/lib/python3.8/site-packages/pkg_resources/tests/data/my-test-package-source
- mymath:
  - miniconda3/pkgs/python-3.8.5-h7579374_1/info/recipe/tests/cmake
  - miniconda3/pkgs/python-3.8.5-h7579374_1/info/test/tests/cmake
  - miniconda3/pkgs/python-3.8.8-hdb3f193_4/info/recipe/tests/cmake
  - miniconda3/pkgs/python-3.8.8-hdb3f193_4/info/test/tests/cmake

我怀疑$PATH需要修改,这是我所做的:

ubuntu@rosfoxy:~$ echo $PATH
/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
ubuntu@rosfoxy:~$ conda activate base
(base) ubuntu@rosfoxy:~$ echo $PATH
/home/ubuntu/miniconda3/bin:/home/ubuntu/miniconda3/condabin:/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
(base) ubuntu@rosfoxy:~$ conda deactivate 
ubuntu@rosfoxy:~$ echo $PATH
/home/ubuntu/miniconda3/condabin:/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
ubuntu@rosfoxy:~$ export PATH=/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
ubuntu@rosfoxy:~$ echo $PATH
/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

但仍然得到:

ubuntu@rosfoxy:~$ ros2 run py_pubsub talker
Package 'py_pubsub' not found
ubuntu@rosfoxy:~$ . install/setup.bash
bash: install/setup.bash: No such file or directory

请指教,谢谢!

4

0 回答 0