Skip to content

Commit b1684d2

Browse files
author
Matthias Koeppe
committed
README.md: Start with installing git if not installed already
1 parent 50b47cd commit b1684d2

File tree

1 file changed

+61
-36
lines changed

1 file changed

+61
-36
lines changed

README.md

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,22 @@ in the Installation Guide.
150150
capitalization when changing into :envvar:`SAGE_ROOT` can lead to build
151151
errors for dependencies requiring exact capitalization in path names.
152152

153-
2. Clone the sources.
153+
2. Clone the sources with `git`:
154+
155+
- To check that `git` is available, open a terminal and enter
156+
the following command at the shell prompt (`$`):
157+
158+
$ git --version
159+
git version 2.42.0
160+
161+
The exact version does not matter, but if this command gives an error,
162+
install `git` using your package manager, using one of these commands:
163+
164+
$ sudo pacman -S git # on Arch Linux
165+
$ sudo apt-get update && apt-get install git # on Debian/Ubuntu
166+
$ sudo yum install git # on Fedora/Redhat/CentOS
167+
$ sudo zypper install git # on openSUSE
168+
$ sudo xbps-install git # on Void Linux
154169

155170
- Create the directory where `SAGE_ROOT` should be established:
156171

@@ -163,16 +178,18 @@ in the Installation Guide.
163178
--origin upstream --branch develop --tags \
164179
https://github.com/sagemath/sage.git
165180

181+
This command obtains the most recent development release.
182+
Replace `--branch develop` by `--branch master` to select
183+
the most recent stable release instead.
184+
166185
This will create the subdirectory `~/sage/sage`. (See the section
167186
[Setting up git](https://doc.sagemath.org/html/en/developer/git_setup.html)
168187
and the following sections in the Sage Developer's Guide
169188
for more information.)
170189

171-
Change into it and pick the branch you need, typically
172-
the latest development branch:
190+
- Change into the created subdirectory:
173191

174192
$ cd sage
175-
$ git checkout develop
176193

177194
- [Windows] The Sage source tree contains symbolic links, and the
178195
build will not work if Windows line endings rather than UNIX
@@ -181,7 +198,16 @@ in the Installation Guide.
181198
Therefore it is recommended (but not necessary) to use the
182199
WSL version of `git`.
183200

184-
3. [Linux, WSL] Install the required minimal build prerequisites.
201+
3. Install system packages.
202+
203+
Either refer for this to the [section on installation from
204+
source](https://doc.sagemath.org/html/en/installation/source.html) in the
205+
Sage Installation Manual for compilations of system packages
206+
that you can install. When done, skip to step 7 (bootstrapping).
207+
208+
Alternatively, follow the more fine-grained approach below.
209+
210+
4. [Linux, WSL] Install the required minimal build prerequisites:
185211

186212
- Compilers: `gcc`, `gfortran`, `g++` (GCC versions from 8.4.0 to 13.x
187213
and recent versions of Clang (LLVM) are supported).
@@ -190,12 +216,12 @@ in the Installation Guide.
190216
for a discussion of suitable compilers.
191217

192218
- Build tools: GNU `make`, GNU `m4`, `perl` (including
193-
``ExtUtils::MakeMaker``), `ranlib`, `git`, `tar`, `bc`.
219+
`ExtUtils::MakeMaker`), `ranlib`, `git`, `tar`, `bc`.
194220
See [build/pkgs/_prereq/SPKG.rst](build/pkgs/_prereq/SPKG.rst) for
195221
more details.
196222

197223
- Python 3.4 or later, or Python 2.7, a full installation including
198-
`urllib`; but ideally version 3.9.x, 3.10.x, or 3.11.x, which
224+
`urllib`; but ideally version 3.9.x, 3.10.x, 3.11.x, 3.12.x, which
199225
will avoid having to build Sage's own copy of Python 3.
200226
See [build/pkgs/python3/SPKG.rst](build/pkgs/python3/SPKG.rst)
201227
for more details.
@@ -214,22 +240,25 @@ in the Installation Guide.
214240
[void.txt](build/pkgs/_prereq/distros/void.txt), or visit
215241
https://doc.sagemath.org/html/en/reference/spkg/_prereq.html#spkg-prereq
216242

217-
4. [Git] If you plan to do Sage development or otherwise work with ticket branches
218-
and not only releases, install the bootstrapping prerequisites. See the
219-
files in the folder
243+
5. Optional: It is recommended that you have both LaTeX and
244+
the ImageMagick tools (e.g. the "convert" command) installed
245+
since some plotting functionality benefits from them.
246+
247+
6. [Development] If you plan to do Sage development or otherwise work with
248+
ticket branches and not only releases, install the bootstrapping
249+
prerequisites. See the files in the folder
220250
[build/pkgs/_bootstrap/distros](build/pkgs/_bootstrap/distros), or
221251
visit
222252
https://doc.sagemath.org/html/en/reference/spkg/_bootstrap.html#spkg-bootstrap
223253

224-
5. [Git] If you cloned the Sage repository using `git`, bootstrap the
225-
source tree using the following command:
254+
7. Bootstrap the source tree using the following command:
226255

227256
$ make configure
228257

229-
(If the bootstrapping prerequisites are not installed, this command will
230-
download a package providing pre-built bootstrap output instead.)
258+
(If the bootstrapping prerequisites are not installed, this command
259+
will download a package providing pre-built bootstrap output instead.)
231260

232-
6. Sanitize the build environment. Use the command
261+
8. Sanitize the build environment. Use the command
233262

234263
$ env
235264

@@ -261,7 +290,7 @@ in the Installation Guide.
261290
can also add it to your shell profile so that it gets run
262291
automatically in all future sessions.)
263292

264-
7. Optionally, decide on the installation prefix (`SAGE_LOCAL`):
293+
9. Optionally, decide on the installation prefix (`SAGE_LOCAL`):
265294

266295
- Traditionally, and by default, Sage is installed into the
267296
subdirectory hierarchy rooted at `SAGE_ROOT/local/`.
@@ -279,15 +308,11 @@ in the Installation Guide.
279308
installs (`make install` is a no-op). Therefore the
280309
installation hierarchy must be writable by the user.
281310

282-
- See the installation manual for options if you want to
311+
- See the Sage Installation Manual for options if you want to
283312
install into shared locations such as `/usr/local/`.
284313
Do not attempt to build Sage as `root`.
285314

286-
8. Optional: It is recommended that you have both LaTeX and
287-
the ImageMagick tools (e.g. the "convert" command) installed
288-
since some plotting functionality benefits from them.
289-
290-
9. Optionally, review the configuration options, which includes
315+
10. Optionally, review the configuration options, which includes
291316
many optional packages:
292317

293318
$ ./configure --help
@@ -305,7 +330,7 @@ in the Installation Guide.
305330
a great speedup when switching between different branches, at the
306331
expense of disk space use.
307332

308-
10. Optional, but highly recommended: Set some environment variables to
333+
11. Optional, but highly recommended: Set some environment variables to
309334
customize the build.
310335

311336
For example, the `MAKE` environment variable controls whether to
@@ -327,7 +352,7 @@ in the Installation Guide.
327352
building Sage, see [the installation
328353
guide](https://doc.sagemath.org/html/en/installation/source.html#environment-variables).
329354

330-
11. Type `./configure`, followed by any options that you wish to use.
355+
12. Type `./configure`, followed by any options that you wish to use.
331356
For example, to build Sage with `gf2x` package supplied by Sage,
332357
use `./configure --with-system-gf2x=no`.
333358

@@ -347,60 +372,60 @@ in the Installation Guide.
347372
available; only the most recent releases of your distribution will
348373
have all of these recommended packages.
349374

350-
12. Optional: If you choose to install the additional system packages,
375+
13. Optional: If you choose to install the additional system packages,
351376
a re-run of `./configure` will test whether the versions installed
352377
are usable for Sage; if they are, this will reduce the compilation
353378
time and disk space needed by Sage. The usage of packages may be
354379
adjusted by `./configure` parameters (check again the output of
355380
`./configure --help`).
356381

357-
13. Type `make`. That's it! Everything is automatic and
382+
14. Type `make`. That's it! Everything is automatic and
358383
non-interactive.
359384

360385
If you followed the above instructions, in particular regarding the
361386
installation of system packages recommended by the output of
362-
`./configure` (step 10), and regarding the parallel build (step 9),
387+
`./configure` (step 11), and regarding the parallel build (step 10),
363388
building Sage takes less than one hour on a modern computer.
364389
(Otherwise, it can take much longer.)
365390

366391
The build should work fine on all fully supported platforms. If it
367392
does not, we want to know!
368393

369-
14. Type `./sage` to try it out. In Sage, try for example `2 + 2`,
394+
15. Type `./sage` to try it out. In Sage, try for example `2 + 2`,
370395
`plot(x^2)`, `plot3d(lambda x, y: x*y, (-1, 1), (-1, 1))`
371396
to test a simple computation and plotting in 2D and 3D.
372397
Type <kbd>Ctrl</kbd>+<kbd>D</kbd> or `quit` to quit Sage.
373398

374-
15. Optional: Type `make ptestlong` to test all examples in the documentation
399+
16. Optional: Type `make ptestlong` to test all examples in the documentation
375400
(over 200,000 lines of input!) -- this takes from 10 minutes to
376401
several hours. Don't get too disturbed if there are 2 to 3 failures,
377402
but always feel free to email the section of `logs/ptestlong.log` that
378403
contains errors to the [sage-support mailing list](https://groups.google.com/group/sage-support).
379404
If there are numerous failures, there was a serious problem with your build.
380405

381-
16. The HTML version of the [documentation](https://doc.sagemath.org/html/en/index.html)
406+
17. The HTML version of the [documentation](https://doc.sagemath.org/html/en/index.html)
382407
is built during the compilation process of Sage and resides in the directory
383408
`local/share/doc/sage/html/`. You may want to bookmark it in your browser.
384409

385-
17. Optional: If you want to build the PDF version of the documentation,
410+
18. Optional: If you want to build the PDF version of the documentation,
386411
run `make doc-pdf` (this requires LaTeX to be installed).
387412

388-
18. Optional: Install optional packages of interest to you:
413+
19. Optional: Install optional packages of interest to you:
389414
get a list by typing `./sage --optional` or by visiting the
390415
[packages documentation page](https://doc.sagemath.org/html/en/reference/spkg/).
391416

392-
19. Optional: Create a symlink to the installed `sage` script in a
393-
directory in your `PATH`, for example ``/usr/local``. This will
417+
20. Optional: Create a symlink to the installed `sage` script in a
418+
directory in your `PATH`, for example `/usr/local`. This will
394419
allow you to start Sage by typing `sage` from anywhere rather than
395420
having to either type the full path or navigate to the Sage
396421
directory and type `./sage`. This can be done by running:
397422

398423
$ sudo ln -s $(./sage -sh -c 'ls $SAGE_ROOT/venv/bin/sage') /usr/local/bin
399424

400-
20. Optional: Set up SageMath as a Jupyter kernel in an existing Jupyter notebook
425+
21. Optional: Set up SageMath as a Jupyter kernel in an existing Jupyter notebook
401426
or JupyterLab installation, as described in [section
402427
"Launching SageMath"](https://doc.sagemath.org/html/en/installation/launching.html)
403-
in the installation manual.
428+
in the Sage Installation Manual.
404429

405430
Alternative Installation using PyPI
406431
---------------

0 commit comments

Comments
 (0)