ROS2 Foxy on Windows 10 - command line tools not working

asked 2023-05-11 10:58:25 -0600

HenryInUtah gravatar image

updated 2023-05-11 11:01:00 -0600


I have installed ROS2 Foxy on Windows 10 using the directions located here:

The installation seemed to work OK but I am having errors when I run some of the command line tools. Currently, I am trying to learn by watching YouTube videos (which are geared towards ROS2 on Linux) and apply the content to Windows. I can run the example talker/listener without error and even run my own simple Python nodes.

But using commands like "ros2 node list" or "ros2 topic list" do not work. Here is an example:

C:\Windows\System32>ros2 topic list
Failed to load entry point 'list': [WinError 193] %1 is not a valid Win32 application
Traceback (most recent call last):
  File "c:\opt\ros\foxy\x64\Scripts\", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.9.10', 'console_scripts', 'ros2')())
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2cli\", line 39, in main
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2cli\command\", line 250, in add_subparsers_on_demand
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2topic\command\", line 29, in add_arguments
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2cli\command\", line 237, in add_subparsers_on_demand
    extension = command_extensions[name]
KeyError: 'list'

when I run "ros2 doctor --report" I get the following error message

C:\Windows\System32>ros2 doctor --report
Traceback (most recent call last):
  File "c:\opt\ros\foxy\x64\Scripts\", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.9.10', 'console_scripts', 'ros2')())
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2cli\", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2doctor\command\", line 51, in main
    all_reports = generate_reports()
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2doctor\api\", line 121, in generate_reports
    report_class = report_entry_pt.load()
  File "c:\opt\ros\foxy\x64\lib\site-packages\pkg_resources\", line 2447, in load
    return self.resolve()
  File "c:\opt\ros\foxy\x64\lib\site-packages\pkg_resources\", line 2453, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2doctor\api\", line 17, in <module>
    from import DirectNode
  File "c:\opt\ros\foxy\x64\lib\site-packages\ros2cli\node\", line 18, in <module>
    import rclpy.action
  File "c:\opt\ros\foxy\x64\lib\site-packages\rclpy\action\", line 15, in <module>
    from .client import ActionClient  # noqa: F401
  File "c:\opt\ros\foxy\x64\lib\site-packages\rclpy\action\", line 32, in <module>
    from unique_identifier_msgs.msg import UUID
  File "c:\opt\ros\foxy\x64\lib\site-packages\unique_identifier_msgs\msg\", line 1, in <module>
    from unique_identifier_msgs.msg._uuid import UUID  # noqa: F401
  File "c:\opt\ros\foxy\x64\lib\site-packages\unique_identifier_msgs\msg\", line 9, in <module>
    import numpy  # noqa: E402, I100
  File "C:\Users\henry\AppData\Roaming\Python\Python38\site-packages\numpy\__init__ ...
edit retag flag offensive close merge delete


quick comment: this could be due to mismatching Python versions. Python-on-Windows (and Windows in general) is picky about this. See ros2/ros2#525 for a similar report.

Make sure you have no alternative Python interpreters 'activated' or taking the default spot in the search order. The second backtrace shows paths in C:\Users\henry\AppData\Roaming\Python\Python38 which seems to suggest something is installed there which interferes.

gvdhoorn gravatar image gvdhoorn  ( 2023-05-13 02:34:26 -0600 )edit

Thank you! I was worried about this... Python was already installed on this machine and I use it all the time. It seems that ROS2 is sometimes picking up things from the "other" python.

I tried to follow the directions in the post you recommended: in C:\opt\ros\foxy\x64\Scripts\ the first line was changed from



#!C:\Program Files\Python39\python.exe

but that had even worse results and running ros2 from the prompt resulted in "failed to create process."

Is there a procedure for having a non-ROS2 Python installation exist? Do you think I would be better off starting a new question with the assumption that this is the cause of the problem?

Thanks again for your help.

HenryInUtah gravatar image HenryInUtah  ( 2023-05-15 11:12:55 -0600 )edit

Unfortunately, I've got no helpful advice I believe. I've never really used ROS 2 on Windows -- at least not for any real work.

I do know -- from reading interactions between others who do use ROS 2 on Windows -- that you can't really change the version of Python used with your ROS 2 installation, as ROS 2 uses quite a few native extensions (ie: C/C++ compiled into .dlls) which get loaded by Python at runtime. The version of Python loading the extensions and the one used to build them must match.

That could be the cause of what you're seeing.

gvdhoorn gravatar image gvdhoorn  ( 2023-05-15 13:08:45 -0600 )edit

Thank you for your help - it highlighted the problem with the Python versions.

I'm not sure how to solve it in a nice way. I can't just remove all other development tools from this computer - I will try creating a new user and just install ROS2 on that user account. Maybe that will keep it separate. Using ROS2 on Windows is extremely frustrating.

HenryInUtah gravatar image HenryInUtah  ( 2023-05-15 13:31:47 -0600 )edit

You could perhaps comment on the issue I linked.

Or post a new question, with just the Python versioning problem as the subject.

Or ask Microsoft. Depending on whether you're using the "ROS 2 Windows binary archive" or the Microsoft supported install of course.

Using ROS2 on Windows is extremely frustrating.

Even though I don't have a lot of experience with it, what bit me the most was just the difference between Windows and Linux development practices -- including environment setup.

I can't just remove all other development tools from this computer

wouldn't careful attention to how PATHs are configured be a possible way to manage this?

That'd be almost like working with venvs.

Only if you're working with ROS would you need the python.exe in c:\opt\ros\foxy\x64 on the %PATH%.

Similar to how vcvarsall.bat manages paths for the ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2023-05-15 13:37:07 -0600 )edit