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

ROS kinetic: ImportError: No module named terminal_color

asked 2018-08-27 07:12:19 -0500

inspire gravatar image

updated 2018-08-27 07:24:41 -0500

Hi,

I a trying to compile a catkin package that shall generate some ROS messages. Unfortunately I get to this error an can't get it resolved:

Traceback (most recent call last):
  File "/opt/ros/kinetic/share/geneus/cmake/../../../lib/geneus/gen_eus.py", line 39, in <module>
    import geneus
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/geneus/__init__.py", line 32, in <module>
    from . geneus_main import *
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/geneus/geneus_main.py", line 43, in <module>
    from catkin import terminal_color
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/catkin/terminal_color.py", line 2, in <module>
    from catkin_pkg.terminal_color import *  # noqa
ImportError: No module named terminal_color

Some days ago I updated my ROS packages and before it was working.

Here is some more information:

$ dpkg -L python-catkin-pkg-modules
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/python-catkin-pkg-modules
/usr/share/doc/python-catkin-pkg-modules/copyright
/usr/share/doc/python-catkin-pkg-modules/changelog.Debian.gz
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/catkin_pkg
/usr/lib/python2.7/dist-packages/catkin_pkg/topological_order.py
/usr/lib/python2.7/dist-packages/catkin_pkg/metapackage.py
/usr/lib/python2.7/dist-packages/catkin_pkg/tool_detection.py
/usr/lib/python2.7/dist-packages/catkin_pkg/terminal_color.py
/usr/lib/python2.7/dist-packages/catkin_pkg/changelog_generator.py
/usr/lib/python2.7/dist-packages/catkin_pkg/__init__.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cmake.py
/usr/lib/python2.7/dist-packages/catkin_pkg/changelog_generator_vcs.py
/usr/lib/python2.7/dist-packages/catkin_pkg/templates
/usr/lib/python2.7/dist-packages/catkin_pkg/templates/CMakeLists.txt.in
/usr/lib/python2.7/dist-packages/catkin_pkg/templates/package.xml.in
/usr/lib/python2.7/dist-packages/catkin_pkg/templates/metapackage.cmake.in
/usr/lib/python2.7/dist-packages/catkin_pkg/python_setup.py
/usr/lib/python2.7/dist-packages/catkin_pkg/group_dependency.py
/usr/lib/python2.7/dist-packages/catkin_pkg/package_templates.py
/usr/lib/python2.7/dist-packages/catkin_pkg/workspace_vcs.py
/usr/lib/python2.7/dist-packages/catkin_pkg/package.py
/usr/lib/python2.7/dist-packages/catkin_pkg/group_membership.py
/usr/lib/python2.7/dist-packages/catkin_pkg/packages.py
/usr/lib/python2.7/dist-packages/catkin_pkg/changelog.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/prepare_release.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/create_pkg.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/test_changelog.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/generate_changelog.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/tag_changelog.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/__init__.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/find_pkg.py
/usr/lib/python2.7/dist-packages/catkin_pkg/cli/package_version.py
/usr/lib/python2.7/dist-packages/catkin_pkg/package_version.py
/usr/lib/python2.7/dist-packages/catkin_pkg/condition.py
/usr/lib/python2.7/dist-packages/catkin_pkg/rospack.py
/usr/lib/python2.7/dist-packages/catkin_pkg/workspaces.py
/usr/lib/python2.7/dist-packages/catkin_pkg_modules-0.4.8.egg-info
/usr/lib/python2.7/dist-packages/catkin_pkg_modules-0.4.8.egg-info/top_level.txt
/usr/lib/python2.7/dist-packages/catkin_pkg_modules-0.4.8.egg-info/dependency_links.txt
/usr/lib/python2.7/dist-packages/catkin_pkg_modules-0.4.8.egg-info/PKG-INFO
/usr/lib/python2.7/dist-packages/catkin_pkg_modules-0.4.8.egg-info/requires.txt


$ sudo ...
(more)
edit retag flag offensive close merge delete

Comments

I believe this is a duplicate of #q294780. Can you please check?

gvdhoorn gravatar image gvdhoorn  ( 2018-08-27 07:28:44 -0500 )edit

you might be right although I am on ROS kinetic and not melodic. Also python-catkin-pkg and python-catkin-pkg-modules are up to date which is the solution of the accepted answer in the other question. Pip also tells me the package is up to date with "pip install --upgrade catkin_pkg_modules".

inspire gravatar image inspire  ( 2018-08-27 07:33:28 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2018-08-27 13:14:07 -0500

Dirk Thomas gravatar image

With the current release of catkin as well as catkin_pkg this will not be a problem. As suggested before you likely have an older version of catkin_pkg installed via pip. You should uninstall the pip installed package and only use the Debian package.

edit flag offensive delete link more
0

answered 2018-12-24 23:25:19 -0500

In my case, disable anaconda in ~/.bashrc if you have installed that. :)

edit flag offensive delete link more
0

answered 2018-08-27 08:19:24 -0500

inspire gravatar image

updated 2018-08-27 08:19:32 -0500

Okay I found a workaround: In /opt/ros/kinetic/lib/python2.7/dist-packages/catkin/terminal_color.py change the line

from catkin_pkg.terminal_color import *

to

from catkin.terminal_color import *

Then it is able to find terminal_color. Maybe the catkin_pkg package hasn't been fully updated and is corrupted now? This fix I made should actually be fixed in the provided package.

edit flag offensive delete link more

Comments

According to ros/catkin#943, the from catkin_pkg is actually correct.

Perhaps @Dirk Thomas can shed some light on this.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-27 08:24:36 -0500 )edit

I would recommend to remove the pip version(s) you installed of the related package(s). Just to save you some headaches in the future.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-27 08:25:36 -0500 )edit

good idea, thanks :)

inspire gravatar image inspire  ( 2018-08-27 08:35:54 -0500 )edit

Question Tools

Stats

Asked: 2018-08-27 07:12:19 -0500

Seen: 5,230 times

Last updated: Dec 24 '18