Ask Your Question
1

problem creating a new package with catkin_create_pkg

asked 2013-09-26 21:18:15 -0500

ane_fernandez gravatar image

updated 2013-09-26 21:47:13 -0500

I'm trying to create a new package in my workspace with catkin_create_pkg and I get this error:

afgonzalez@afgonzalez-desktop:~/ros_workspace/src$ catkin_create_pkg 
  Traceback (most recent call last):
  File "/usr/local/bin/catkin_create_pkg", line 10, in <module>
  from catkin_pkg.package_templates import create_package_files, PackageTemplate

  ImportError: No module named catkin_pkg.package_templates</div>

I have reinstalled ros-groovy-catkin and python-catkin-pkg package but the error still there.

edit retag flag offensive close merge delete

Comments

Please post the version number of your catkin_pkg package: python -c "import catkin_pkg; print(catkin_pkg.__version__)"

Dirk Thomas gravatar image Dirk Thomas  ( 2013-09-29 21:49:03 -0500 )edit

The version of the catkin_pkg is 0.1.20

ane_fernandez gravatar image ane_fernandez  ( 2013-09-29 23:28:16 -0500 )edit

Please get the folder where catkin_pkg is in your installation ( python -c "import catkin_pkg; print(catkin_pkg.__file__)" ) and post the directory content.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-09-30 07:58:52 -0500 )edit

The directory content is: /usr/lib/pymodules/python2.7/catkin_pkg/__init__.pyc

ane_fernandez gravatar image ane_fernandez  ( 2013-09-30 20:12:44 -0500 )edit

That is pretty incomplete. Please remove remove the file and reinstall the Debian package python-catkin-pkg again.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-10-01 07:34:56 -0500 )edit

I have deleted __init__.pyc file and reinstalled the python-catkin-pkg and the templates aren't found yet. The content directory is still the same: /usr/lib/pymodules/python2.7/catkin_pkg/__init__.pyc

ane_fernandez gravatar image ane_fernandez  ( 2013-10-02 04:10:28 -0500 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2013-09-27 07:00:25 -0500

William gravatar image

Looks like you have an out-of-date caktin_pkg, but since you said that you have updated recently I would guess that you're using Ubuntu and had catkin_pkg installed from pip at some point.

See:

http://answers.ros.org/question/49143/problems-with-rqt-groovy-ubuntu/?answer=49153#post-id-49153

edit flag offensive delete link more

Comments

I have followed the instructions of the link but the error is still there.

ane_fernandez gravatar image ane_fernandez  ( 2013-09-29 21:22:40 -0500 )edit

That's odd, the only way this can occur is if you don't have catkin_pkg installed or you have an older version installed which is overriding the updated one (which is commonly the case with `pip` and `apt-get`). Which is what @Dirk Thomas is getting at in his above comments.

William gravatar image William  ( 2013-09-30 08:17:00 -0500 )edit
0

answered 2013-10-01 02:53:21 -0500

mbkv gravatar image

updated 2013-10-01 02:56:14 -0500

I faced a similar issue. Now just to cross-check
1. Add 'source /opt/ros/<groovy>/setup.bash' to your ~/.bashrc file and re-start your terminal. (Of course, <groovy> should be replaced by your ROS distro without the angled brackets)
2. Issue the command 'bash'
3. Delete the catkin workspace folder you created earlier
4. Use the command to create a new catkin workspace
The folders src, devel and build should be present
5. Issue the command source devel/setup.bash
6. Then get inside src and try to create the package.

edit flag offensive delete link more

Comments

I have followed all your instructions but the problem is still there.

ane_fernandez gravatar image ane_fernandez  ( 2013-10-01 03:07:06 -0500 )edit

This would not help. catkin_create_pkg does not all depend on the environment or a catkin workspace since it is provided by the distro independent package catkin_pkg.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-10-01 07:36:37 -0500 )edit

@Dirk Thomas: Right.The above steps would help only if the sourcing is not done properly and the commands like 'rospack' or 'catkin_create_pkg' are not recognized.

mbkv gravatar image mbkv  ( 2013-10-01 07:54:38 -0500 )edit

No, catkin_create_pkg is not found via the environment provided by the setup.* files. catkin_create_pkg is installed globally into /usr/bin.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-10-01 08:32:43 -0500 )edit
0

answered 2013-09-27 05:26:26 -0500

joq gravatar image

Make sure you followed the creating a catkin workspace tutorial quite literally. Pay special attention to these commands:

$ source /opt/ros/groovy/setup.bash

and

$ source devel/setup.bash

They set up your shell environment to correctly resolve ROS references.

edit flag offensive delete link more

Comments

I have created the workspace following the tutorial of creating a catkin workspace and I have set up the shell environment properly, but the templates aren't found.

ane_fernandez gravatar image ane_fernandez  ( 2013-09-29 21:24:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-09-26 21:18:15 -0500

Seen: 2,418 times

Last updated: Oct 01 '13