source: general/prog/python3.xml@ c9b65a3d

trunk
Last change on this file since c9b65a3d was c9b65a3d, checked in by Bruce Dubbs <bdubbs@…>, 3 weeks ago

Update to Python3-3.12.4

  • Property mode set to 100644
File size: 13.9 KB
RevLine 
[ab4fdfc]1<?xml version="1.0" encoding="UTF-8"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[52d29f7]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
[2cee003]7 <!ENTITY python3-download-http
[3f89ec5]8 "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
[355495ce]9 <!ENTITY python3-download-ftp " ">
[c9b65a3d]10 <!ENTITY python3-md5sum "d68f25193eec491eb54bc2ea664a05bd">
[7420ff72]11 <!ENTITY python3-size "20 MB">
[c9b65a3d]12 <!ENTITY python3-buildsize "336 MB (add 59 MB for tests)">
13 <!ENTITY python3-time "2.3 SBU (add 1.5 SBU for tests; both using parallelism=4)">
[e882fc37]14 <!--
[deaa200]15 Note: Size does not reflect docs that were installed in LFS.
[c9b65a3d]16 Test time measured with 60 second timeout.
[3df4c93]17 -->
[2cee003]18 <!ENTITY python3htmldoc-download-http
[1fe05eb]19 "https://www.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
[5895a37]20 <!ENTITY python3-docs-md5sum "6025ee63c0ded34aac874f5da8f1a90c" >
[52d29f7]21]>
22
[b88be39]23<sect1 id="python3" xreflabel="Python-&python3-version;">
24 <?dbhtml filename="python3.html" ?>
[83f69e5d]25
26
[b88be39]27 <title>Python-&python3-version;</title>
[83f69e5d]28
[b88be39]29 <indexterm zone="python3">
[03d30cf]30 <primary sortas="a-Python3">Python3</primary>
[83f69e5d]31 </indexterm>
32
33 <sect2 role="package">
[03d30cf]34 <title>Introduction to Python 3</title>
[83f69e5d]35
[355495ce]36 <para>
[03d30cf]37 The <application>Python 3</application> package contains the
[355495ce]38 <application>Python</application> development environment.
39 This is useful for object-oriented programming, writing scripts,
40 prototyping large programs or developing entire applications.
41 </para>
[48b816cb]42
[de33b2a]43 <note>
44 <para>
45 <application>Python 3</application> was installed in LFS.
46 The only reason to rebuild it here is if optional modules
[b9a6bcc0]47 are needed, or to upgrade this package.
[de33b2a]48 </para>
49 </note>
[60ddbaf]50
[5d0e7b8]51 &lfs121_checked;
[48b816cb]52
[bd68243]53 <important>
54 <para>
55 If upgrading to a new Python-3 minor version (for example,
[7420ff72]56 from Python-3.11.x to Python-3.12.0), you will need to reinstall
[bd68243]57 any Python3 modules you have installed. You should also
58 reinstall packages that generate Python3 modules
[54d58907]59 including
[c0bc0a9]60 &gobject-introspection;,
[8748122]61 <xref linkend="libxml2"/>,
[bd68243]62 <xref linkend="opencv"/>,
[26ca5bd0]63 <xref linkend="fontforge"/>,
64 <xref linkend="gnome-tweaks"/>,
65 <xref linkend="samba"/>, and
[bf09c25]66 <xref linkend="graphviz"/> (if swig is installed).
67 </para>
68
[fb0bbe2]69 <para>Before you upgrade, you can get a list of modules installed
70 with <command>pip3 list</command>. The list may be incomplete as
71 some Python modules are not installed with <command>pip3</command>,
72 for example the <literal>cracklib</literal> module installed by
73 <xref role='nodep' linkend='cracklib'/>. Use <command>ls
74 /usr/lib/python3.<replaceable>minor</replaceable>/site-packages</command>
75 for a comprehensive list.
[bd68243]76 </para>
[ec288f7]77
78 <para>
[fb0bbe2]79 The Python modules from LFS will also have to be reinstalled:
80 <ulink url="&lfs-root;/chapter08/flit-core.html">flit-core</ulink>,
[32c1b77]81 <ulink url="&lfs-root;/chapter08/wheel.html">wheel</ulink>,
[7420ff72]82 <ulink url="&lfs-root;/chapter08/setuptools.html">setuptools</ulink>,
[32c1b77]83 <ulink url="&lfs-root;/chapter08/meson.html">meson</ulink>,
84 <ulink url="&lfs-root;/chapter08/markupsafe.html">MarkupSafe</ulink>,
85 and <ulink url="&lfs-root;/chapter08/jinja2.html">Jinja2</ulink>.
[ec288f7]86 </para>
[bd68243]87 </important>
88
[83f69e5d]89 <bridgehead renderas="sect3">Package Information</bridgehead>
90 <itemizedlist spacing="compact">
91 <listitem>
[355495ce]92 <para>
93 Download (HTTP): <ulink url="&python3-download-http;"/>
94 </para>
[83f69e5d]95 </listitem>
96 <listitem>
[355495ce]97 <para>
98 Download (FTP): <ulink url="&python3-download-ftp;"/>
99 </para>
[83f69e5d]100 </listitem>
101 <listitem>
[355495ce]102 <para>
103 Download MD5 sum: &python3-md5sum;
104 </para>
[83f69e5d]105 </listitem>
106 <listitem>
[355495ce]107 <para>
108 Download size: &python3-size;
109 </para>
[83f69e5d]110 </listitem>
111 <listitem>
[355495ce]112 <para>
113 Estimated disk space required: &python3-buildsize;
114 </para>
[83f69e5d]115 </listitem>
116 <listitem>
[355495ce]117 <para>
118 Estimated build time: &python3-time;
119 </para>
[83f69e5d]120 </listitem>
121 </itemizedlist>
[e882fc37]122
[3df4c93]123 <bridgehead renderas="sect3">Additional Optional Download</bridgehead>
124 <itemizedlist spacing="compact">
125 <listitem>
126 <para>
127 Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
128 </para>
129 </listitem>
130 <listitem>
131 <para>
132 Download MD5 sum: &python3-docs-md5sum;
133 </para>
134 </listitem>
135 </itemizedlist>
136
[03d30cf]137 <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
[e882fc37]138
[693f28e1]139 <bridgehead renderas="sect4">Recommended</bridgehead>
140 <para role="recommended">
[a82b5f44]141 <xref linkend="sqlite"/> (required if building firefox or thunderbird)
[693f28e1]142 </para>
143
[83f69e5d]144 <bridgehead renderas="sect4">Optional</bridgehead>
[355495ce]145 <para role="optional">
[7fe0ce3b]146 <xref linkend="bluez"/>,
[e882fc37]147 <xref linkend="gdb"/> (required for some tests),
148 <xref linkend="valgrind"/>, and
[4e207bb]149 <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
[355495ce]150 </para>
151
152 <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
153 <para role="optional">
[dcd5a063]154 <xref linkend="libnsl"/>,
155 <xref linkend="tk"/>, and
156 &berkeley-db;
[355495ce]157 </para>
[ce33273]158
[42ddc30]159 <para condition="html" role="usernotes">Editor Notes:
[355495ce]160 <ulink url="&blfs-wiki;/Python3"/>
161 </para>
[83f69e5d]162 </sect2>
163
164 <sect2 role="installation">
[03d30cf]165 <title>Installation of Python 3</title>
[83f69e5d]166
[355495ce]167 <para>
[03d30cf]168 Install <application>Python 3</application> by running the following
[355495ce]169 commands:
170 </para>
[83f69e5d]171
[a87fb41]172<screen><userinput>CXX="/usr/bin/g++" \
173./configure --prefix=/usr \
174 --enable-shared \
175 --with-system-expat \
176 --enable-optimizations &amp;&amp;
[83f69e5d]177make</userinput></screen>
178
[355495ce]179 <para>
[c721d0d]180 Some tests are known to occasionally hang indefinitely. So to test
181 the results, run the test suite but set a 2-minute time limit for each
182 test case:
183 </para>
184
185<screen remap='test'><userinput>make test TESTOPTS="--timeout 120"</userinput></screen>
186
[c9b65a3d]187 <!--
188 For Python-3.12.3 all tests pass
[c721d0d]189 Total tests: run=41,778 skipped=1,155
190 Total test files: run=485/488 skipped=24 resource_denied=3
[c9b65a3d]191
192 For Python-3.13.4
193 Total tests: run=42,152 failures=6 skipped=1,234
194 Total test files: run=487/489 failed=4 skipped=17 resource_denied=6 rerun=4
[c721d0d]195 -->
196
197 <para>
198 For a relatively slow system you may need to increase the time
199 limit and 1 SBU (measured when building Binutils pass 1 with one CPU
200 core) should be enough. Some tests are flaky, so the test suite will
201 automatically re-run failed tests. If a test failed but then passed
202 when re-run, it should be considered as passed.
[355495ce]203 </para>
204
[c9b65a3d]205 <para>
206 Of over 42,000 tests, the following are known to fail: test__xxsubinterpreters,
207 test_import, test_interpreters, and test_threading.
208 </para>
209
[355495ce]210 <para>
211 Now, as the <systemitem class="username">root</systemitem> user:
212 </para>
213
[3df4c93]214<screen role="root"><userinput>make install</userinput></screen>
215
216 <para>
[1fe05eb]217 If upgrading and the documentation has been downloaded, optionally install
[3df4c93]218 it as the &root; user:
219 </para>
220
[4be7bcd]221<screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python3-version;/html
222
223tar --strip-components=1 \
[3df4c93]224 --no-same-owner \
225 --no-same-permissions \
226 -C /usr/share/doc/python-&python3-version;/html \
227 -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
[1970f00]228
[879d269]229 </sect2>
230
231 <sect2 role="commands">
232 <title>Command Explanations</title>
233
[fd69a62]234 <para>
235 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
236 message during configuration.
237 </para>
238
[355495ce]239 <para>
[f1d7196]240 <parameter>--with-system-expat</parameter>: This switch enables linking
241 against the system version of <application>Expat</application>.
[355495ce]242 </para>
243
[988edbf5]244<!--
[fd69a62]245 <para>
[6e94284]246 <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
[8558044]247 the <command>pip</command> and <command>setuptools</command> packaging
[229d069]248 programs. <command>setuptools</command> is needed for building some
249 Python modules.
[fd69a62]250 </para>
[988edbf5]251-->
[f1d7196]252
[7c57f82]253 <para>
[a0bb9145]254 <parameter>--enable-optimizations</parameter>: This switch enables
[a87fb41]255 stable, but expensive, optimizations.
[7c57f82]256 </para>
257
258 <para>
259 <option>--with-lto</option>: This optional switch enables thick Link
260 Time Optimization. Unusually, it creates a much larger <filename
[4e207bb]261 class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-&lt;arch&gt;-linux-gnu/libpython&python3-majorver;.a</filename>
[7c57f82]262 with a small increase in the time to compile
263 <application>Python</application>. Run-time results do not appear to show
264 any benefit from doing this.
265 </para>
[7224506]266
[879d269]267 </sect2>
268
269 <sect2 role="configuration">
[03d30cf]270 <title>Configuring Python 3</title>
[879d269]271
[355495ce]272 <para>
[03d30cf]273 In order for <command>python3</command> to find the installed
[d7015e7]274 documentation, create the following version independent symlink:
[355495ce]275 </para>
[1970f00]276
[d7015e7]277<screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
278
279 <para>
280 and add the following environment variable to the individual user's or
281 system's profile:
282 </para>
283
284<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
[83f69e5d]285
286 </sect2>
287
288 <sect2 role="content">
289 <title>Contents</title>
290
291 <segmentedlist>
292 <segtitle>Installed Programs</segtitle>
293 <segtitle>Installed Libraries</segtitle>
294 <segtitle>Installed Directories</segtitle>
295
296 <seglistitem>
[355495ce]297 <seg>
[f2ff0e4]298 2to3 (symlink) and
[355495ce]299 2to3-&python3-majorver;,
300
[229d069]301 <!--
[f2ff0e4]302 easy_install-&python3-majorver;,
[229d069]303 -->
[f2ff0e4]304
305 idle3 (symlink) and
306 idle&python3-majorver;,
[f5c5306]307
[deaa200]308 pip3 and
[f2ff0e4]309 pip&python3-majorver;,
310
[deaa200]311 pydoc3 (symlink) and
[355495ce]312 pydoc&python3-majorver;,
313
[deaa200]314 python3 (symlink) and
[f2ff0e4]315 python&python3-majorver;, and
[355495ce]316
[f2ff0e4]317 python3-config (symlink) and
318 python&python3-majorver;-config
[355495ce]319 </seg>
320 <seg>
[9e91b25]321 libpython&python3-majorver;.so and libpython3.so
[355495ce]322 </seg>
323 <seg>
[9e91b25]324 /usr/include/python&python3-majorver;,
[355495ce]325 /usr/lib/python&python3-majorver;, and
326 /usr/share/doc/python-&python3-version;
327 </seg>
[83f69e5d]328 </seglistitem>
329 </segmentedlist>
330
331 <variablelist>
332 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
333 <?dbfo list-presentation="list"?>
334 <?dbhtml list-presentation="table"?>
[f2ff0e4]335 <!--
336 <varlistentry id="2to3">
337 <term><command>2to3</command></term>
338 <listitem>
339 <para>
340 is designed to assist in the transition between python2 and python3
341 by automatically converting code to be Python3 compatible.
342 </para>
343 <indexterm zone="python3 2to3">
344 <primary sortas="b-2to3">2to3</primary>
345 </indexterm>
346 </listitem>
347 </varlistentry>
348 Put here for easy use when removing Python2 -->
[229d069]349 <!--
[f2ff0e4]350 <varlistentry id="easy_install">
351 <term><command>easy_install</command></term>
352 <listitem>
353 <para>
354 is a frontend to pip3 to make it easier to configure python modules
[4c24eb0a]355 through the PIP package manager
[f2ff0e4]356 </para>
357 <indexterm zone="python3 easy_install">
358 <primary sortas="python3 easy_install">easy_install</primary>
359 </indexterm>
360 </listitem>
361 </varlistentry>
[229d069]362 -->
[355495ce]363 <varlistentry id="idle3">
364 <term><command>idle3</command></term>
[83f69e5d]365 <listitem>
[355495ce]366 <para>
[d0aecd33]367 is a wrapper script that opens a <application>Python</application>
368 aware GUI editor. For this script to run, you must have installed
369 <application>Tk</application> before Python so that the Tkinter
[4c24eb0a]370 Python module is built
[355495ce]371 </para>
372 <indexterm zone="python3 idle3">
373 <primary sortas="b-idle3">idle3</primary>
[83f69e5d]374 </indexterm>
375 </listitem>
376 </varlistentry>
377
[355495ce]378 <varlistentry id="pydoc3">
379 <term><command>pydoc3</command></term>
[83f69e5d]380 <listitem>
[355495ce]381 <para>
382 is the <application>Python</application> documentation
[4c24eb0a]383 tool
[355495ce]384 </para>
385 <indexterm zone="python3 pydoc3">
386 <primary sortas="b-pydoc3">pydo3c</primary>
[83f69e5d]387 </indexterm>
388 </listitem>
389 </varlistentry>
390
[b88be39]391 <varlistentry id="python3-prog">
[2cee003]392 <term><command>python3</command></term>
[83f69e5d]393 <listitem>
[355495ce]394 <para>
395 is an interpreted, interactive, object-oriented programming
[4c24eb0a]396 language
[355495ce]397 </para>
[b88be39]398 <indexterm zone="python3 python3-prog">
399 <primary sortas="b-python3">python3</primary>
[83f69e5d]400 </indexterm>
401 </listitem>
402 </varlistentry>
403
[f67f5387]404 <varlistentry id="python-ver">
[b88be39]405 <term><command>python&python3-majorver;</command></term>
[83f69e5d]406 <listitem>
[355495ce]407 <para>
408 is a version-specific name for the <command>python</command>
[4c24eb0a]409 program
[355495ce]410 </para>
[b88be39]411 <indexterm zone="python3 python-ver">
[4c24eb0a]412 <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
[83f69e5d]413 </indexterm>
414 </listitem>
415 </varlistentry>
[f2ff0e4]416 <!--
[21e8edc]417 <varlistentry id="pyvenv">
418 <term><command>pyvenv</command></term>
419 <listitem>
420 <para>
421 creates virtual <application>Python</application> environments in
422 one or more target directories.
423 </para>
424 <indexterm zone="python3 pyvenv">
425 <primary
426 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
427 </indexterm>
428 </listitem>
429 </varlistentry>
[f2ff0e4]430 -->
[83f69e5d]431 </variablelist>
432
433 </sect2>
[f45b1953]434
435</sect1>
Note: See TracBrowser for help on using the repository browser.