Ask Your Question
1

Colcon fails to build Python package: "error in 'egg_base'"

asked 2020-10-23 12:13:37 -0500

jschornak gravatar image

updated 2020-10-23 12:43:07 -0500

After I ran an apt upgrade this morning, Colcon fails to build ROS2 Python packages from source with the following error:

    $ colcon build --packages-up-to joint_state_publisher
Starting >>> joint_state_publisher
--- stderr: joint_state_publisher                   
error: error in 'egg_base' option: '../../../build/joint_state_publisher' does not exist or is not a directory
---
Failed   <<< joint_state_publisher [0.44s, exited with code 1]

Summary: 0 packages finished [0.76s]
  1 package failed: joint_state_publisher
  1 package had stderr output: joint_state_publisher

I am using this branch: https://github.com/ros/joint_state_pu...

Based on some of the other results from searching for this error (such as this one: https://answers.ros.org/question/3091...) I think this might be related to parsing the package's setup.py file, rather than something necessarily ROS-specific.

edit retag flag offensive close merge delete

Comments

I have the same problem. In my case, the issue is caused by the fact that I used symbolic links from the workspace src folder to the actual sources. Without symbolic links, the issue does not seem to occur. Can you confirm if this is the same for you?

mheidingsfeld gravatar image mheidingsfeld  ( 2020-10-27 10:20:45 -0500 )edit

@mheidingsfeld I indeed can confirm this. I just tried copying packages instead of using links and I am not getitng this issue anymore

viktor.holova gravatar image viktor.holova  ( 2020-10-27 11:56:48 -0500 )edit

To me this seem to be an issue with colcon and Python packages. It can be easily reproduced with this minimal example:

mkdir -p test/ws/src
cd test/ws/src
ros2 pkg create --build-type ament_python foo
cd ..
colcon build # Works ...
rm -rf build/ install/ log/
mv src/foo ../
ln -s $(pwd)/../foo src/foo
colcon build # Fails ...
mheidingsfeld gravatar image mheidingsfeld  ( 2020-10-27 12:36:31 -0500 )edit

@mheidingsfeld I can duplicate your minimal example, and I get the same error as I did previously.

In my original case, my project src directory was symlinked to the src directory of a different workspace (an important detail that had slipped my mind, since I'd set up this workspace months and months ago). I made a minimal example to test this situation, and I discovered that if I build the workspace containing the non-symlinked directory first, the workspace containing the symlinked directory succeeds.

This works:

mkdir -p test_ws/src
cd test_ws/src
ros2 pkg create --build-type ament_python foo
cd ../..
mkdir test_link_ws
cd test_link_ws
ln -s ../test_ws/src src
cd ../test_ws
colcon build  # succeeds
cd ../test_link_ws
colcon build  # also succeeds
jschornak gravatar image jschornak  ( 2020-10-28 12:09:50 -0500 )edit

This fails:

mkdir -p test_ws/src
cd test_ws/src
ros2 pkg create --build-type ament_python foo
cd ../..
mkdir test_link_ws
cd test_link_ws
ln -s ../test_ws/src src
cd ../test_link_ws
colcon build  # fails
jschornak gravatar image jschornak  ( 2020-10-28 12:11:35 -0500 )edit

I am facing the exact same problem, also having a symlinked workspace. I know the setup worked months ago, most likely with an older colcon version.

potentialdiffer gravatar image potentialdiffer  ( 2020-10-29 05:16:44 -0500 )edit

I create an issue about this here: https://github.com/colcon/colcon-core...

jschornak gravatar image jschornak  ( 2020-10-29 15:58:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-06-09 21:58:29 -0500

janindu gravatar image

updated 2021-06-09 21:58:58 -0500

I came across the same issue today, and after digging up a little, I was able to solve this by using the --symlink-install flag.

How to reproduce the solution:

mkdir -p test_ws/src
cd test_ws/src
ros2 pkg create --build-type ament_python foo
cd ../
colcon build

This obviously builds fine.

Now :

rm -rf build install log
mv src/foo ..
ln -s $(pwd)/../foo src/foo
colcon build

This fails.

But now

rm -rf build install log
colcon build --symlink-install

should build successfully.

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

3 followers

Stats

Asked: 2020-10-23 12:13:37 -0500

Seen: 369 times

Last updated: Jun 09