[ROS2] "no such command" for using "colcon build --merge-install" on Windows 10
Hi guys, I am learning about ROS2 on Windows 10 today. I tried using the command "colcon build --merge-install", as the tutorial said:
From the root of your workspace (~/dev_ws), you can now build your packages using the command:
Windows:
colcon build --merge-install
Windows doesn’t allow long paths, so merge-install will combine all the paths into the install directory.
But the terminal showed "no such command" for colcon
.
Any answer or idea will be appreciated!
Asked by songyuc on 2020-04-29 05:29:17 UTC
Answers
Just try installing the colcon
as
pip install -U colcon-common-extensions
If you meet any error about "Visual Studio", you can run the command below to enter a Visual Studio (VS) environment as,
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
Note: the exact path of the files or name of the application can be different on your computer.
Asked by songyuc on 2020-04-29 08:23:14 UTC
Comments
If this worked for you, can you accept your answer by clicking on the check mark to the left?
Asked by christophebedard on 2020-04-29 12:48:12 UTC
OK; In fact, I try using the command above, but after running the colcon build --merge-install
, there is an error which shows:
Starting >>> turtlesim
--- stderr: turtlesim
Traceback (most recent call last):
File "c:\python37\lib\site-packages\colcon_core\executor_init.py", line 91, in __call_ rc = await self.task(*args, **kwargs)
File "c:\python37\lib\site-packages\colcon_core\task_init.py", line 93, in __call_ return await task_method(*args, **kwargs)
File "c:\python37\lib\site-packages\colcon_ros\task\ament_cmake\build.py", line 72, in build additional_hooks=additional_hooks)
File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 86, in build rc = await self._reconfigure(args, env)
File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 153, in _reconfigure 'VisualStudioVersion is not set, '
Asked by songyuc on 2020-04-30 03:30:00 UTC
RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.
---
Failed <<< turtlesim [ Exited with code 1 ]
Summary: 0 packages finished [1.17s]
1 package failed: turtlesim
1 package had stderr output: turtlesim
VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.
And do you know how to solve this issue?
Asked by songyuc on 2020-04-30 03:32:52 UTC
The error message is pretty clear. From a quick Google search, I found this: https://answers.ros.org/question/317475/ros2-windows10-colcon-build-fails-on-ros2_example_ws-tutorial/?answer=320193#post-id-320193 Not sure why the Windows installation tutorials don't mention this though.
Asked by christophebedard on 2020-04-30 08:40:25 UTC
actually, it does mention it here: https://index.ros.org/doc/ros2/Tutorials/Colcon-Tutorial/#build-the-workspace
Asked by christophebedard on 2020-04-30 08:41:33 UTC
Thanks for your guide. It seems ROS2 building requires a VS code environment. So, I cannot use my falimilar PyCharm as my ROS IDE, am I right?
Asked by songyuc on 2020-04-30 09:16:43 UTC
Visual Studio, not Visual Studio Code. You can use anything if you execute the command to setup the VS environment (in the solution I linked to above) before executing any colcon command.
Asked by christophebedard on 2020-04-30 09:23:11 UTC
Thanks! The command colcon
can run normally now.
But I still met an error as,
Starting >>> turtlesim
[Processing: turtlesim]
Failed <<< turtlesim [ Exited with code 1 ]
Summary: 0 packages finished [35.5s]
1 package failed: turtlesim
And could you please provide me with more guide and help?
Asked by songyuc on 2020-05-04 05:45:44 UTC
Create a new question
Asked by christophebedard on 2020-05-06 06:58:51 UTC
Comments
Did you install
colcon
? e.g.pip install -U colcon-common-extensions
from here: https://index.ros.org/doc/ros2/Installation/Eloquent/Windows-Development-Setup/#id3Asked by christophebedard on 2020-04-29 08:00:02 UTC
Hi @christophebedard, I didn't intstall colcon, because I followed Installing ROS 2 on Windows, which never mentioned about installing the colcon.
Asked by songyuc on 2020-04-29 08:14:58 UTC
Well don't let that stop you from installing
colcon
. This section does say "If you would like to build your own packages, refer to the tutorial 'Using Colcon to build packages'." And the first step there is to installcolcon
! https://index.ros.org/doc/ros2/Tutorials/Colcon-Tutorial/#install-colconAsked by christophebedard on 2020-04-29 08:17:43 UTC
Thanks sincerely for your kind guide, and I have installed
colcon
, and this issue might be solved.Asked by songyuc on 2020-04-29 08:21:30 UTC