This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Consider revising documentation on Python Builds from source
Type: enhancement Stage: resolved
Components: Documentation, Windows Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, neyuru, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-11-03 23:34 by neyuru, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (6)
msg329211 - (view) Author: Jorge Ramos (neyuru) * Date: 2018-11-03 23:34
I want to build from source a 3.6 Python, using PGO for windows.

Followed instructions at https://devguide.python.org/setup/ (the original search from google was "build python from source windows"). From a newbie perspective there are several problems:

1) it is suggested that you should build first a "debug" python (header 1.3) but they don't tell you how.
2) it is suggested that you should first build via "PCBuild\build.bat" but they don't tell you that this builds a win32 platform. What if I want to build a x64 version? (lost much time here figuring out how)
3) I ran into problems when building with "PCBuild\build.bat" (header 1.3.2) because the dependencies where not all downloaded in the first pass (but this is a bug I could fill later). Lost much time here figuring why the build did not succeed.
4) in (1.3.2) it is suggested you keep reading in a readme file: https://github.com/python/cpython/blob/master/PCbuild/readme.txt This is the first time an optimization is mentioned (other than simply compiling from your machine. I did not know that using PGO was mandatory for real speedups compared to the downloadable “general” binaries).
5) In this very same readme, it says that there are other "subprojects" that you need to consider building with Python. Lost much time here trying to figure out that these subprojects are downloaded via "get_externals.bat" in the "Getting External Sources" section. Why not simply put the "Getting External Sources" section first and avoid worrying the newcomer of potential projects that are "not included with python"?
6) They tell you that PGO is automated via a "build_pgo.bat" file. But this does not exist. 
7) They tell you that first, you have to run the PGInstrument option in the build, but it is not clear what should be run next: PCBuild\build.bat -c PGUpdate -p x64" or "PCBuild\build.bat --pgo -p x64"
8) After 2 days of trying to build (and learn in the process by trial and error) I stumble upon YET ANOTHER WAY TO BUILD: the one found in "cpython\Tools\msi" NOT the first one: "cpython\PCbuild"

And this is the one I was interested in the first place: building an installable version of python (yet I have to figure out how to pack all cab files and such into one exe), not a developer’s python for testing. And after now 3 days with this, I noticed that all previous testing and building techniques are indeed reachable from "cpython\Tools\msi\buildrelease.bat -x64" which tries to build a python in x64 version AND using GPO (by default -in the x64 but not in the win32-, which is not mentioned in the documentation, by the way) also generating the dependencies required (I could have avoided losing some time if knowing this from the very beginning- see point 5)

As you can see, I lost few hours here, few there. And because I am not a developer (my intention is to have an optimized python for my PC for AI research) I lost much time trying to figure out things that are not explicitly said in the documentation: I managed to learn from other sources (googling around), by careful observation of the compilation results, and digging into the help section of each of the files used.
Hope I successfully communicated Python’s lack of proper documentation (just for the case of building from source!)
msg329300 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-11-05 14:26
Most people building Python from the devguide are doing it for contributions, so I'd be very hesitant to change the default recommendations. But we should highlight how to make a working installable build (including the extra dependencies) and the common options on our scripts, as well as their -h options.

I also have a "layout" script coming that will make it easier for people to produce their own custom installers by at least copying the files into the right place.
msg329306 - (view) Author: Jorge Ramos (neyuru) * Date: 2018-11-05 16:28
Thank you, I think that will suffice. At least guide folks like myself who want to build from source and with optimizations in the right direction (on which folder to work on and which commands to issue to the terminal)

Please keep me posted.
msg329307 - (view) Author: Jorge Ramos (neyuru) * Date: 2018-11-05 16:33
One more thing: point in case #6 does credit a revision IMO. The build_pgo.bat file does not exist.
msg329334 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-11-06 03:15
If you're able, you might be the best person to do some of those updates right now :) The rest of us will have to set aside time to get back up to speed on some of the details, and while we'll likely have to do that to review changes anyway, at least that's one less person to wait for.
msg329344 - (view) Author: Jorge Ramos (neyuru) * Date: 2018-11-06 05:10
Although I appreciate the confidence placed in me, I think I'm not exactly the most competent person to make changes to such an important project. I know what -probably- could be improved (from my very narrow point of view) but I don't even know where or how to start so to not screw things up. 

Don't get me wrong, participating in a project like this (no matter how minor the contribution) is an exciting thought but I ignore so many things that I'm afraid I would probably make it worse rather than making it better. Those things where written for a reason and I'm not even close to know or understand the context on why it was so, as to make a meaningful contribution.
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79337
2019-01-11 06:02:08neyurusetstatus: open -> closed
stage: needs patch -> resolved
2018-11-06 05:10:27neyurusetmessages: + msg329344
2018-11-06 03:15:16steve.dowersetmessages: + msg329334
2018-11-05 16:33:25neyurusetmessages: + msg329307
2018-11-05 16:28:46neyurusetmessages: + msg329306
2018-11-05 14:26:38steve.dowersetstage: needs patch
messages: + msg329300
versions: + Python 3.7, Python 3.8
2018-11-04 04:14:30xtreaksetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
components: + Windows
2018-11-03 23:34:29neyurucreate