Skip to content

Dropping python2/pip support #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mr337
Copy link

@mr337 mr337 commented Mar 5, 2022

This PR is to address some of the issues found colcon/colcon-ros-bundle#48.

Issue

For distributions or installs that don't have or need python2/pip this PR addresses that issue. Without this PR you'll get the below error when running colcon bundle

$ colcon bundle
Extracting apt packages...
[589.067s] ERROR:colcon:colcon bundle: [Errno 2] No such file or directory: 'bundle/cache/bundle_staging/usr/bin/python2'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/colcon_core/command.py", line 528, in verb_main
    rc = context.args.main(context=context)
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/verb/bundle.py", line 135, in main
    dependencies_changed = self._manage_dependencies(
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/verb/bundle.py", line 186, in _manage_dependencies
    self._installer_manager.run_installers(
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/verb/_installer_manager.py", line 78, in run_installers
    installer_metadata[name] = installer.install()
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/installer/base_pip_installer.py", line 86, in install
    subprocess.check_call(
  File "/usr/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/bundle/cache/bundle_staging/usr/bin/python2'

Or if you are unlucky and the system does have python2 installed you'll receive this which masks the source problem.

$ colcon bundle
Extracting apt packages...
bundle/cache/bundle_staging/usr/bin/python2: No module named pip
[647.047s] ERROR:colcon:colcon bundle: Command '['/bundle/cache/bundle_staging/usr/bin/python2', '-m', 'pip', 'install', '-U', 'pip==20.*', 'setuptools==44.0.0']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/colcon_core/command.py", line 528, in verb_main
    rc = context.args.main(context=context)
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/verb/bundle.py", line 135, in main
    dependencies_changed = self._manage_dependencies(
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/verb/bundle.py", line 186, in _manage_dependencies
    self._installer_manager.run_installers(
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/verb/_installer_manager.py", line 78, in run_installers
    installer_metadata[name] = installer.install()
  File "/usr/local/lib/python3.8/dist-packages/colcon_bundle/installer/base_pip_installer.py", line 86, in install
    subprocess.check_call(
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['bundle/cache/bundle_staging/usr/bin/python2', '-m', 'pip', 'install', '-U', 'pip==20.*', 'setuptools==44.0.0']' returned non-zero exit status 1.

Solution

Part of this issue is how colcon-ros-bundle is parsing project dependencies and rosdep determines the install. This is true for python dependencies that are installed via pip. When this happens colcon-bundle parses the dep and determines that it is using pip for the install. As far as I can tell it does not make a determination between when to use pip and pip3 and returns what is in the rosdep file. From my findings the only way it will use pip3 is if pip3 is explicitly defined in the rosdep file which I don't believe is within spec.

Since ROS Kinetic has reached EOL, ROS Noetic and on being python3 this PR drops support for python2/pip. To be compatible with rosdep changes the entry point has been changed so any installer of pip will use pip3 under the hood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant