ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

Python-is-python2 is not nice

In case any of you are seeing errors like this in your build after doing an apt upgrade these last few days:

  Traceback (most recent call last):

    File "/usr/lib/python2.7/", line 163, in _run_module_as_main
      mod_name, _Error)
    File "/usr/lib/python2.7/", line 111, in _get_module_details
      __import__(mod_name)  # Do not catch exceptions initializing package
    File "/opt/ros/rolling/lib/python3.8/site-packages/rosidl_adapter/", line 32
      assert False, f"Unsupported interface type '{interface_file.suffix}'"

This was probably caused by an upgrade to python-wstool or python-vcstool which both decided they should depend on python-is-python2. I don’t know what the right solution to this is, but the short story is that if you are maintaining any package that depends on python3 you should probably avoid using the absolute path /usr/bin/python and use python3 instead because these packages exist. Secondly, if you are maintaining something that depends on python2, please do the same and depend on python2 instead of the system-breaking package python-is-python2.

I posted an issue against the vcstool github about this. However, over the last weekend and today, it seems that this issue is being posted over and over on our internal slack. I figured it was enough of a breaking change to post here so it hopefully gets some attention and we can figure out a policy that avoids re-creating this in the future.

As an aside if you are here because of this and want the tl;dr for fixing this locally:

sudo apt purge python-is-python2
sudo apt install python3-vcstool python3-wstool

Aren’t vcstools and wstool archived? Both repositories haven’t seen any changes since 2020-06-25.

Note that vcstools != vcstool. The former is a defunct library. The latter is where you opened the issue I believe.

Thank you for catching that, I updated my post so no one accidentally installs vcstools. If they are archived why was it that when I purged python-is-python2 the only other two packages apt removed from my system were python-wstool and python-vcstool? They should not have been updated in the latest apt upgrade I did.

I have no idea.

I took a quick look, but I cannot find any reference to python-is-python2 in any of the packages/libraries you mentioned.

Perhaps attributing this to vcstool or wstool is premature?

Additionally: I can’t even install python-vcstool or python-wstool on a ros:roling Docker image, as they have no installation candidates. Only the python3 versions can be installed.

What does your apt log say?

PS: perhaps this would be better posted on ROS Answers.

I resolved this simply by setting default python to python3. This is OK for my system, and I want to use python3 everywhere.

When I search through my apt log history this is what I found:

Commandline: apt purge python-is-python2
Requested-By: tyler (1000)
Purge: python-is-python2:amd64 (2.7.17-4), python-vcstools:amd64 (0.1.42-1), python-dev-is-python2:amd64 (2.7.17-4), python-wstool:amd64 (0.1.17-1)
End-Date: 2021-11-06  18:44:43

The apt log which shows the upgrades you mention which installed python-is-python2 would be more helpful.

But again: ROS Answers or the Github issue. No need to spam 50000+ Discourse accounts.

1 Like

@tylerjw can you please re-open this as a question on ROS Answers there are several clarifying questions I have about your system state but neither Discourse nor the vcstool issue is the correct venue for them.