ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Fail building Foxy, ModuleNotFoundError: No module named 'setuptools.extern'

asked 2020-10-05 18:54:02 -0600

achmad_fathoni gravatar image

I have installed setuptools python package:

Name: setuptools
Version: 50.3.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Author: Python Packaging Authority
License: UNKNOWN
Location: /usr/lib/python3.8/site-packages
Required-by: vcstool, pytest-rerunfailures, pipenv, colcon-python-setup-py, colcon-core, Sphinx, rosdistro, jsonschema

But when I run colcon build --symlink-install

Starting >>> ament_package
Starting >>> ament_lint
Starting >>> gtest_vendor
Starting >>> fastcdr
Starting >>> ament_cppcheck
Starting >>> cyclonedds
Starting >>> osrf_pycommon
Starting >>> osrf_testing_tools_cpp
Traceback (most recent call last):] [ament_package - 0.2s] [ament_lint - 0.2s] [gtest_vendor - 0.2s] ...
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools.extern'
--- stderr: ament_package                                                                               
Traceback (most recent call last):
  File "/home/toni/.local/lib/python
3.8/site-packages/colcon_core/executor/", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "/home/toni/.local/lib/python3.8/site-packages/colcon_core/task/", line 93, in __call__
    return await task_method(*args, **kwargs)
  File "/home/toni/.local/lib/python3.8/site-packages/colcon_ros/task/ament_python/", line 51, in build
    setup_py_data = get_setup_data(self.context.pkg, env)
  File "/home/toni/.local/lib/python3.8/site-packages/colcon_core/task/python/", line 20, in get_setup_data
    return dict(pkg.metadata[key](env))
  File "/home/toni/.local/lib/python3.8/site-packages/colcon_ros/package_identification/", line 129, in getter
return get_setup_information(
 File "/home/toni/.local/lib/python3.8/site-packages/colcon_python_setup_py/package_identification/", line 261, in get_setup_information
    _setup_information_cache[hashable_env] = _get_setup_information(
  File "/home/toni/.local/lib/python3.8/site-packages/colcon_python_setup_py/package_identification/", line 301, in _get_setup_information
    result =
  File "/usr/lib/python3.8/", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python', '-c', "import sys;from setuptools.extern.packaging.specifiers 
import SpecifierSet;from distutils.core import run_setup;dist = run_setup(    'setup.p
y', 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(rep(data).encode('utf-8'))"]' returned non-zero exit status 1.

Seems like my setuptools it too up to date. Any ideas?

edit retag flag offensive close merge delete


Please do not cross post: Especially without referencing the duplicate posts.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-10-06 00:23:58 -0600 )edit
achmad_fathoni gravatar image achmad_fathoni  ( 2020-10-06 00:31:39 -0600 )edit

According to Send all questions to ROS Answers or the appropriate mailing list, and report all issues to the issue tracker.

achmad_fathoni gravatar image achmad_fathoni  ( 2020-10-06 00:51:34 -0600 )edit

@achmad_fathoni: yes, but don't do both at the same time.

gvdhoorn gravatar image gvdhoorn  ( 2020-10-06 05:21:51 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-10-05 19:45:28 -0600

achmad_fathoni gravatar image

Well, my guest is right. My setuptools is too up to date. The only think I need to do is change line in /home/toni/.local/lib/python3.8/site-packages/colcon_python_setup_py/package_identification/ line 251. From

'from setuptools.extern.packaging.specifiers import SpecifierSet',


'from packaging.specifiers import SpecifierSet',
edit flag offensive delete link more

Question Tools


Asked: 2020-10-05 18:54:02 -0600

Seen: 1,854 times

Last updated: Oct 05 '20