Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using python virtual environment for ROS2 on windows

It seems that the installation procedure of ROS2 under windows is depending on a python installation in C:\Python37. (As a side node, the recommended "choco install -y python" now installs python 3.8, which is not intended).

I was following the procedure mentioned here to install dashing ROS2 on windows. I found out that the ROS2 distribution has a hardcoded dependency on a python 3.7 installation in C:\Python37.

Because we are using python for different projects which may involve or not involve ROS2, I would like to use a python virtual environment for ROS2. However, it seems that this is not supported, because the scripts using the hardcoded shebang


Even when placing the virtual environment in C:\Python37, the shebang is incorrect, because python would be in


instead. So I am getting errors like "failed to create process" when running ros2. Using "python" instead works though (assuming an activated virtual environment). Changing the shebang would work in principle, but which scripts should I change?

Is it planned to have an installer in the future who cares about these things?