Compiling CPython with packages installed for PGO step

I’m interested in trying out PGO when compiling Python and looked over the documentation here:

I see that with the default it runs the tests but that you can set a value yourself for PROFILE _,TASK, such that your code will be run for PGO purposes.

However, what I’m stuck on is how do you (can you?) handle this if the code you want to run requires packages to be installed. Is there a recommended way to install them against the newly built CPython executable?

Sorry if this is obvious and maybe I’m overlooking something or have the wrong mental model for what’s going on, but I couldn’t see how to set this up up front so that the packages are handled right before it goes into the PGO stage.

I’m primarily interested in doing this for Linux and Windows and am reasonably comfortable with both of them. Let me know if there are any other details I should share.

Not sure if I just chose a hard question or if I’ve left out anything helpful.

Also is this the right section for this or is there a better section of the forum I should raise it in?

Hi @brandtbucher - whilst trying to find an answer to my question here I happened to see a comment you made a little while back about being able to get packages installed within the PROFILE_TASK when using PGO:

Are there any pointers you could share with how one goes about that?

I realise it’s a while back and also it might be a bit cheeky asking out the blue, so I totally understand if you haven’t got time/aren’t keen to get involved! :slightly_smiling_face: