Skip to content

Commit 41ad0b5

Browse files
author
Matthias Koeppe
committed
README.md: Expand section 'Alternative Installation using PyPI'
1 parent c451ea4 commit 41ad0b5

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,47 @@ in the Installation Guide.
420420
Alternative Installation using PyPI
421421
---------------
422422

423-
For installation of `sage` in python using `pip` you need to install `sagemath-standard`. First, activate your python virtual environment and follow these steps:
423+
For installing Sage in a Python environment from PyPI, Sage provides the
424+
`pip`-installable package [sagemath-standard](https://pypi.org/project/sagemath-standard/).
424425

425-
$ python3 -m pip install sage_conf
426-
$ ls $(sage-config SAGE_SPKG_WHEELS)
427-
$ python3 -m pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl sage_setup
428-
$ python3 -m pip install --no-build-isolation sagemath-standard
426+
Unless you need to install Sage into a specific existing environment, we recommend
427+
to create and activate a fresh virtual environment, for example `~/sage-venv/`:
429428

430-
You need to install `sage_conf`, a wheelhouse of various python packages. You can list the wheels using `ls $(sage-config SAGE_SPKG_WHEELS)`. After manual installation of these wheels, you can install the sage library, `sagemath-standard`.
429+
$ python3 -m venv ~/sage-venv
430+
$ source ~/sage-venv/bin/activate
431431

432-
**NOTE:** You can find `sage` and `sagemath` pip packages but with these packages, you will encounter `ModuleNotFoundError`.
432+
As the first installation step, install [sage_conf](https://pypi.org/project/sage-conf/),
433+
which builds various prerequisite packages in a subdirectory of `~/.sage/`:
434+
435+
(sage-venv) $ python3 -m pip install -v sage_conf
436+
437+
After a successful installation, a wheelhouse provides various Python packages.
438+
You can list the wheels using the command:
439+
440+
(sage-venv) $ ls $(sage-config SAGE_SPKG_WHEELS)
441+
442+
If this gives an error saying that `sage-config` is not found, check any messages
443+
that the `pip install` command may have printed. You may need to adjust your `PATH`,
444+
for example by:
445+
446+
$ export PATH="$(python3 -c 'import sysconfig; print(sysconfig.get_path("scripts", "posix_user"))'):$PATH"
447+
448+
Now install the packages from the wheelhouse and the [sage_setup](https://pypi.org/project/sage-conf/)
449+
package, and finally install the Sage library:
450+
451+
(sage-venv) $ python3 -m pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl sage_setup
452+
(sage-venv) $ python3 -m pip install --no-build-isolation -v sagemath-standard
453+
454+
The above instructions install the latest stable release of Sage.
455+
To install the latest development version instead, add the switch `--pre` to all invocations of
456+
`python3 -m pip install`.
457+
458+
**NOTE:** PyPI has various other `pip`-installable packages with the word "sage" in their names.
459+
Some of them are maintained by the SageMath project, some are provided by SageMath users for
460+
various purposes, and others are entirely unrelated to SageMath. Do not use the packages
461+
`sage` and `sagemath`. For a curated list of packages, see the chapter
462+
[Packages and Features](https://doc.sagemath.org/html/en/reference/spkg/index.html) of the
463+
Sage Reference Manual.
433464

434465
SageMath Docker images
435466
----------------------

0 commit comments

Comments
 (0)