Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the Windows instructions for using conda/pixi. #4989

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from

Conversation

clalancette
Copy link
Contributor

This makes the instructions match what CI does in ros2/ci#802 . This relies on ros2/ros2#1642 being merged first.

@clalancette clalancette requested a review from audrow as a code owner February 3, 2025 19:09
Copy link

github-actions bot commented Feb 3, 2025

HTML artifacts: https://github.com/ros2/ros2_documentation/actions/runs/13567449249/artifacts/2663373185.

To view the resulting site:

  1. Click on the above link to download the artifacts archive
  2. Extract it
  3. Open html-artifacts-4989/index.html in your favorite browser

Copy link
Contributor

@j-rivero j-rivero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice reduction in the number of steps required.

There are some references to chocolatey in the Troubleshooting and Contributing documents:

source/How-To-Guides/Installation-Troubleshooting.rst:We've seen that sometimes the chocolatey packages for ``asio``, ``tinyxml2``, etc. do not add important registry entries and CMake will be unable to find them when building ROS 2.
source/How-To-Guides/Installation-Troubleshooting.rst:We've not yet been able to identify the root cause, but uninstalling the chocolatey packages (with ``-n`` if the uninstall fails the first time), and then reinstalling them will fix the issue.
source/How-To-Guides/Installation-Troubleshooting.rst:- ``choco uninstall patch; colcon build --cmake-clean-cache`` - This is a bug in the `GNU Patch For Windows package <https://chocolatey.org/packages/patch>`_. If this package is not installed, the build process will instead use the version of Patch distributed with git.
source/The-ROS2-Project/Contributing/Windows-Tips-and-Tricks.rst:Unfortunately, the ``patch`` executable as delivered by chocolatey requires Administrator access to run.

Do we need to remove these ones?

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/upcoming-switch-of-windows-installation-to-pixi-conda/41916/1

Copy link
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so much better!

Testing Windows Development Setup on a Windows 11 machine. I'm still waiting for colcon build --merge-install to complete because it's a very slow machine.

I also had to uninstall stuff previously installed for ROS 2. I don't think we need to include this in these pages, but posting in case someone else runs into this.

  • choco uninstall all
  • Had to manually delete a bunch of system environment variable entries so packages don't try to use uninstalled programs.


.. code-block:: console

irm https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools_2019.exe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I first tried this, I got the following error:

irm : The remote name could not be resolved: 'aka.ms'
At line:1 char:1
+ irm https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildt ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest
   :HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.Powe
   rShell.Commands.InvokeRestMethodCommand

I resolved this by going to a web browser, typing aka.ms, and logging in to a microsoft account. After that this command worked.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get this issue during my run on windows 11, but perhaps that's due to that I'm already logged into a microsoft account trying this out already. Did you try this with a guest login or a container?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved this by going to a web browser, typing aka.ms, and logging in to a microsoft account. After that this command worked.

Hm, that step really should not be required. I am not logged in to anything on my Windows VM, and I am able to run this command as-is. Can you try again? Maybe even also try downloading on linux with "wget"?


.. code-block:: console

vs_buildtools_2019.exe --quiet --wait --norestart --add Microsoft.Component.MSBuild --add Microsoft.Net.Component.4.6.1.TargetingPack --add Microsoft.Net.Component.4.8.SDK --add Microsoft.VisualStudio.Component.CoreBuildTools --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.VisualStudio.Component.TextTemplating --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vs_buildtools_2019.exe --quiet --wait --norestart --add Microsoft.Component.MSBuild --add Microsoft.Net.Component.4.6.1.TargetingPack --add Microsoft.Net.Component.4.8.SDK --add Microsoft.VisualStudio.Component.CoreBuildTools --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.VisualStudio.Component.TextTemplating --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools
.\vs_buildtools_2019.exe --quiet --wait --norestart --add Microsoft.Component.MSBuild --add Microsoft.Net.Component.4.6.1.TargetingPack --add Microsoft.Net.Component.4.8.SDK --add Microsoft.VisualStudio.Component.CoreBuildTools --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.VisualStudio.Component.TextTemplating --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools

Need to start command with .\ or else I get the following error:

PS C:\Users\slore> vs_buildtools_2019.exe --quiet --wait --norestart --add Microsoft.Component.MSBuild --add Microsoft.Net.Component.4.6.1.TargetingPack --add Microsoft.Net.Component.4.8.SDK --add Microsoft.VisualStudio.Component.CoreBuildTools --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.VisualStudio.Component.TextTemplating --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools
vs_buildtools_2019.exe : The term 'vs_buildtools_2019.exe' is not
recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ vs_buildtools_2019.exe --quiet --wait --norestart --add Microsoft.Com ...
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (vs_buildtools_2019.exe:Stri
   ng) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
 
Suggestion [3,General]: The command vs_buildtools_2019.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\vs_buildtools_2019.exe". See "get-help about_Command_Precedence" for more details.


.. code-block:: console

pixi install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to close and reopen powershell before this command worked. I think it's necessary because pixi isn't on PATH in the current shell after installing it.

PS C:\dev> pixi install
pixi : The term 'pixi' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ pixi install
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (pixi:String) [], CommandNot
   FoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, good point. I'll add in an instruction to reopen.


.. code-block:: console

vs_buildtools_2019.exe --quiet --wait --norestart --add Microsoft.Component.MSBuild --add Microsoft.Net.Component.4.6.1.TargetingPack --add Microsoft.Net.Component.4.8.SDK --add Microsoft.VisualStudio.Component.CoreBuildTools --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.VisualStudio.Component.TextTemplating --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.CoreIde --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not pretty sure about the --quiet flag, I was expecting something when I executed the command, a window or something but the command just returned without a message. Removing this flag I was able to see a wizard running.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, these instructions are directly copied out of the Dockerfile. I agree that this isn't great, but even if we remove --quiet, a lot of stuff happens kind of "behind the scenes" that is not obvious. My take on this is that we leave this as-is, but add a note saying that this will take a while and not print anything.

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These instructions are working on cmd.exe but in some parts of the documentation we are also adding instructions for PowerShell. Does it make sense to add them here ?

.. code-block:: console

cd C:\dev
pixi shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting that on Windows 11, I needed to make sure that the execution policy was set correctly:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just mind that the Set-ExecutionPolicy is a powershell only command. This is not necessary in the command prompt as mentioned that the user should open in the instructions.

But yes it is a bit confusing to switch terminals half way...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I don't have Windows 11 installed: is the Set-ExecutionPolicy needed to install MSVC, to install pixi itself, to run pixi install, or to use pixi shell (or all of them)? That will determine where we end up putting this command.

Copy link
Contributor

@knmcguire knmcguire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Probably there are too many 'captains' (reviewers) on this ship, but my curiosity got the better of me and tried these instructions out anyway😄

I found a couple of more issues with the instructions of the source build which I've added, I couldn't test out the binary build since the right zip aren't available yet.


.. code-block:: console

irm https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools_2019.exe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Window 11 (version 10.0.26100) I got a permission error. I had to go to C:/Users/[USER]/downloads and download the vsbuildstool there (and run it with .\ as @sloretz already mentioned below.)

irm : Access to the path 'C:\vs_buildtools_2019.exe' is denied.
At line:1 char:1
+ irm https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildt ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-RestMethod], Unaut
   horizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft
   .PowerShell.Commands.InvokeRestMethodCommand

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is most likely due to that powershell was not run with administrator access. Either that needs to be added to the instructions, or the user account of the computer needs to get full control

.. code-block:: console

cd C:\dev
pixi shell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just mind that the Set-ExecutionPolicy is a powershell only command. This is not necessary in the command prompt as mentioned that the user should open in the instructions.

But yes it is a bit confusing to switch terminals half way...


.. code-block:: console

irm https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools_2019.exe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get this issue during my run on windows 11, but perhaps that's due to that I'm already logged into a microsoft account trying this out already. Did you try this with a guest login or a container?

@clalancette
Copy link
Contributor Author

These instructions are working on cmd.exe but in some parts of the documentation we are also adding instructions for PowerShell. Does it make sense to add them here ?

But yes it is a bit confusing to switch terminals half way...

I don't disagree with these sentiments. These instructions were originally written to more-or-less directly mimic what the Dockerfile does in ros2/ci#802 . In that PR, we use powershell to do some of the setup, cmd to do some of the other setup, and then cmd again to actually run the build and test. While we could probably change that code to use powershell everywhere, that is going to require a lot more validation. I'm not going to have time to do that.

So we need to decide: is it better to more closely follow the CI instructions, or is it better to have a "consistent" powershell experience in the user instructions? Thoughts?

@knmcguire
Copy link
Contributor

For this PR, following the CI instructions should be fine. It's already such an improvement to what it was before, so anything that will just enhance that (like making it PowerShell consistent), can be in a separate PR after this one.

Signed-off-by: Chris Lalancette <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants