Ask Your Question
3

attribute error when running catkin_make

asked 2014-03-11 06:25:40 -0600

Mate Wolfram gravatar image

Hi,

I keep getting this error when running catkin_make

/opt/ros/hydro/share/catkin/cmake/em/order_packages.cmake.em:23: error: <type 'exceptions.AttributeError'>: 'str' object has no attribute 'name'
Traceback (most recent call last):
  File "/usr/bin/empy", line 3288, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3286, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3269, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2273, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2264, in wrap
    apply(callable, args)
  File "/usr/bin/empy", line 2337, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2379, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2399, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1410, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2576, in execute
    exec statements in self.globals
  File "<string>", line 17, in <module>
  File "/usr/lib/pymodules/python2.7/catkin_pkg/topological_order.py", line 109, in topological_order
    return topological_order_packages(packages, whitelisted=whitelisted, blacklisted=blacklisted, underlay_packages=dict(underlay_packages.values()))
  File "/usr/lib/pymodules/python2.7/catkin_pkg/topological_order.py", line 154, in topological_order_packages
    return [(path, package) for path, package in tuples if package.name not in underlay_decorators_by_name]
AttributeError: 'str' object has no attribute 'name'
CMake Error at /opt/ros/hydro/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/incubed/migrate_ws/build/catkin_generated/env_cached.sh
  "/usr/bin/empy" "--raw-errors" "-F"
  "/home/incubed/migrate_ws/build/catkin_generated/order_packages.py" "-o"
  "/home/incubed/migrate_ws/build/catkin_generated/order_packages.cmake"
  "/opt/ros/hydro/share/catkin/cmake/em/order_packages.cmake.em") returned
  error code 1
Call Stack (most recent call first):
  /opt/ros/hydro/share/catkin/cmake/em_expand.cmake:23 (safe_execute_process)
  /opt/ros/hydro/share/catkin/cmake/catkin_workspace.cmake:28 (em_expand)
  CMakeLists.txt:63 (catkin_workspace)

I'm on Ubuntu 12.04 and ROS Hydro.

Any ideas how I could fix this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-03-15 13:41:57 -0600

covertbagel gravatar image

updated 2014-03-15 20:04:06 -0600

I got this today while trying to install ROS Hydro on my Raspberry Pi as per [1]. Overall, installing ROS from source is very aggravating and maybe someday I'll try to make some similar framework that just gets the job done and doesn't have all this extra crap to deal with... but as to our problem...

Looks like you've got a circular dependency amongst your packages. Of course, it won't straight up tell you that's the problem though--no that would be far too kind--you must manually edit your catkin_pkg/topological_order.py and look for this comment:

# in case of a circular dependency pass a string with
# the names list of remaining package names, with path
# None to indicate cycle

Then after appending to ordered_packages you could add a line like:

print('Circular dependency within packages: {}'.format(ordered_packages[-1][1]))

It's up to you to muck around with the package.xml files until the cycle is broken and everything still somehow builds. That's what I'm doing right now. Good luck.

PS - That line I suggest adding really should just be in there already WTF people?

[1] (Sorry about the space) http:// wiki.ros.org/ROSberryPi/Setting%20up%20Hydro%20on%20RaspberryPi

EDIT THE FIRST:

I managed to get past this error condition by commenting out as few <build-depend> entries as possible within my set of circularly dependent packages but there's another edit I made to topological_order.py to make this easier. In the second while loop of _sort_decorated_packages:

while len(packages) > 0:
    # find all packages without build dependencies
    message_generators = []
    non_message_generators = []
    for name, decorator in packages.items():

        # Add the next two lines so that a package doesn't get stuck depending on only itself
        if name in decorator.depends_for_topological_order:
            decorator.depends_for_topological_order.remove(name)

        if not decorator.depends_for_topological_order:
            if decorator.message_generator:
                message_generators.append(name)
            else:
                non_message_generators.append(name)

No new problems yet but the RasPi is a little slow so we'll see... in any case at this point it would be different from this particular issue. Good luck again!

PS - This edit also seems like an oversight in the code? Won't know for sure until the build finishes though

EDIT THE SECOND:

I spoke too soon. After having satisfied topological_order.py with package.xml comments, cmake may get mad at some packages because it expects to see the a dependency but doesn't... so you'll want to revert said changes in those packages after building starts proper but before the modified package is built. That's a mouthful and I apologize in advance but it worked for me.

EDIT THE THIRD:

I have a working ROS install now! My improved version of catkin_pkg is available at [2] and I'll be keeping it in sync with the original until they accept my changes. It provides actionable feedback on cyclic dependencies and handles self-dependencies correctly. You're still on your own with trying to tweak <build-depend> and possibly reverting changes before cmake gets ... (more)

edit flag offensive delete link more

Comments

2

Please create your own framework and stop annoying the thousands of people who find ROS useful. This is a question and answer forum. If you have something useful to contribute, please post a question or answer one.

joq gravatar imagejoq ( 2014-03-15 14:36:38 -0600 )edit
1

@joq Dude calm down I haven't given up on ROS entirely yet ^_^ In case you didn't notice I did try to answer the question after that little one paragraph vent. That said, can we all agree this error is currently not presented to the user in an actionable way?

covertbagel gravatar imagecovertbagel ( 2014-03-15 15:20:02 -0600 )edit
0

answered 2014-03-11 09:46:36 -0600

William gravatar image

Try updating catkin-pkg?

sudo apt-get update
sudo apt-get install python-catkin-pkg
edit flag offensive delete link more

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: 2014-03-11 06:25:40 -0600

Seen: 1,239 times

Last updated: Mar 15 '14