Error installing ROS2 Galactic on Windows 10

asked 2022-02-23 10:53:49 -0500

Anogornian gravatar image

I've been trying to install ROS2 Galactic on a computer running Windows 10 for the first time. I'm pretty new to ROS/ROS2, Python, and the command line, so please excuse any dumb mistakes. I followed the installation instructions found on the ROS2 website (, but when I got to the portion where you run the demo publisher and subscriber I ran into an issue. The C++ publisher (demo_nodes_cpp talker) runs fine and I get the expected hello world output. However, when I try to run the python subscriber (demo_nodes_py listener) I get the following traceback:

run demo_nodes_py listener
Traceback (most recent call last):
  File "C:\dev\ros2_galactic\lib\demo_nodes_py\", line 33, in <module>
    sys.exit(load_entry_point('demo-nodes-py==0.14.3', 'console_scripts', 'listener')())
  File "C:\dev\ros2_galactic\lib\demo_nodes_py\", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "c:\python38\lib\importlib\", line 77, in load
    module = import_module('module'))
  File "c:\python38\lib\importlib\", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\dev\ros2_galactic\Lib\site-packages\demo_nodes_py\topics\", line 16, in <module>
    from rclpy.node import Node
  File "C:\dev\ros2_galactic\Lib\site-packages\rclpy\", line 43, in <module>
    from rclpy.client import Client
  File "C:\dev\ros2_galactic\Lib\site-packages\rclpy\", line 22, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
  File "C:\dev\ros2_galactic\Lib\site-packages\rclpy\impl\", line 32, in <module>
    rclpy_implementation = import_c_library('._rclpy_pybind11', package)
  File "C:\dev\ros2_galactic\Lib\site-packages\rpyutils\", line 38, in import_c_library
    with add_dll_directories_from_env('PATH'):
  File "c:\python38\lib\", line 113, in __enter__
    return next(self.gen)
  File "C:\dev\ros2_galactic\Lib\site-packages\rpyutils\", line 49, in add_dll_directories_from_env
  File "c:\python38\lib\", line 1109, in add_dll_directory
    cookie = nt._add_dll_directory(path)
OSError: [WinError 87] The parameter is incorrect: '.'

When that didn't work I tried the demo_nodes_cpp listener, which worked perfectly. I continued through the tutorials, as I planned to only program in C++, and was able to run turtlesim and turtle_teleop_key without much issue, but when I tried to run rqt I got a very similar looking error:

Traceback (most recent call last):
  File "C:\dev\ros2_galactic\Scripts\", line 33, in <module>
    sys.exit(load_entry_point('rqt-gui==1.1.1', 'console_scripts', 'rqt')())
  File "C:\dev\ros2_galactic\Lib\site-packages\rqt_gui\", line 87, in main
  File "C:\dev\ros2_galactic\Lib\site-packages\rqt_gui\", line 55, in main
    argv = rclpy.utilities.remove_ros_args(args=argv)
  File "C:\dev\ros2_galactic\Lib\site-packages\rclpy\", line 44 ...
edit retag flag offensive close merge delete


When you are doing the installation, make sure to run as Administrator.

This error is usually caused by access issues.

OSError: [WinError 87] The parameter is incorrect: '.'
osilva gravatar image osilva  ( 2022-02-24 06:48:25 -0500 )edit

Thanks for your response! Unfortunately, I'm already running as Administrator.

Anogornian gravatar image Anogornian  ( 2022-02-24 21:31:21 -0500 )edit

Hi there. I'm not sure exactly what is causing this error since it is difficult to repro, but I may recommend you uninstalling and then reinstalling from Robostack instead (uses conda).

yujinkim gravatar image yujinkim  ( 2022-03-04 17:50:39 -0500 )edit

In your galactic folder, navigate to Lib/site-packages/rpyutils, and open Line 48 should be "if os.path.isdir(prefix_path):". Replace that with "if os.path.isdir(prefix_path) and prefix_path != '.':". I was having the exact same error and that seems to fix it for me.

Chrispy_Bacon11 gravatar image Chrispy_Bacon11  ( 2022-05-09 22:09:49 -0500 )edit

I'm trying to figure out what's putting . on the path in the first place. I came here because I was having the same/similar problem with a Robostack Galactic install on Windows.

My base environment and a freshly created empty environment don't have . on the path but my galactic and noetic environments do. Unfortunately because I'm using them with Jupyter and a bunch of other packages, there's a lot to go through, and I have to start from scratch and see if I can track down what part of the installation is doing this. Presumably something in the Galactic base install if we're having the same problem.

danzimmerman gravatar image danzimmerman  ( 2022-06-17 17:59:18 -0500 )edit

Actually now that I restarted my terminal window . is on the path of all my environments including base. Not in the basic command prompt without Mamba/Conda though.

danzimmerman gravatar image danzimmerman  ( 2022-06-17 18:25:02 -0500 )edit

In my case it was an interaction between Windows Terminal and Conda environment activation (using Mambaforge) that is putting . on the path in the first place.

danzimmerman gravatar image danzimmerman  ( 2022-06-23 09:03:10 -0500 )edit