colcon / colcon-core

Command line tool to build sets of software packages

Home Page:http://colcon.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

empy version incompatibility

EduPonz opened this issue · comments

It seems that empy 4.0 (released ~6 h ago) has breaking changes which make colcon-core to fail miserably. This is breaking our CI as we simply install colcon and let the package manager to resolve the dependencies

Steps to reproduce

Doing the following:

docker run -it --rm ubuntu:22.04
# Within the container
apt update && apt install python3 python3-pip
pip3 install -U colcon-common-extensions
colcon

The colcon call fails with:

ERROR:colcon.colcon_core.extension_point:Exception loading extension 'colcon_core.environment_variable.powershell_command': cannot import name 'OVERRIDE_OPT' from 'em' (/usr/local/bin/em.py) The Python package 'empy' must be installed and 'em' must not be installed since both packages share the same namespace
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/colcon_core/extension_point.py", line 116, in load_extension_points
    extension_type = load_extension_point(name, value, group)
  File "/usr/local/lib/python3.10/dist-packages/colcon_core/extension_point.py", line 157, in load_extension_point
    return EntryPoint(name, value, group).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/dist-packages/colcon_powershell/shell/powershell.py", line 17, in <module>
    from colcon_core.shell.template import expand_template
  File "/usr/local/lib/python3.10/dist-packages/colcon_core/shell/template/__init__.py", line 19, in <module>
    raise e from None
  File "/usr/local/lib/python3.10/dist-packages/colcon_core/shell/template/__init__.py", line 10, in <module>
    from em import OVERRIDE_OPT
ImportError: cannot import name 'OVERRIDE_OPT' from 'em' (/usr/local/bin/em.py) The Python package 'empy' must be installed and 'em' must not be installed since both packages share the same namespace

usage: colcon [-h] [--log-base LOG_BASE] [--log-level LOG_LEVEL] {build,extension-points,extensions,graph,info,list,metadata,test,test-result,version-check} ...

Error: No verb provided

Tentative fix

Until colcon supports empy v4, one thing that I could do to get things back up and running was:

pip3 uninstall empy
pip3 install empy==3.3.4

Another way to fix the issue is to install empy 3.3.4 before installing colcon, that'd be:

pip3 install empy==3.3.4
pip3 install -U colcon-common-extensions

I don't have a proper environment here to test the change and open a PR, but I think that most likely the fix is as simple as setting the version here:

EmPy

That'd be something like: EmPy==3.3.4.

Issue reproduced +1

I'll version-bind the dependency tomorrow. Thanks for reporting.