Skip to content

Commit

Permalink
updated the installation page with tab based navigation (#608)
Browse files Browse the repository at this point in the history
* [skip actions][skip azp][skip cirrus] updated the installation page with tab based navigation

* [skip actions][skip azp][skip cirrus]  changed the custom tab based installation navigation to the themes built-in shortcode for tabs

* [skip actions][skip azp][skip cirrus] removed hyperlinks, moved types-stubs from the tab-based navigation

* [skip actions][skip azp][skip cirrus] moved the See next steps out of the tabs component

* style nit

* [skip actions][skip azp][skip cirrus] corrected the hyperlinks

* Update install.md

* lint

---------

Co-authored-by: Lucas Colley <[email protected]>
  • Loading branch information
Musharraffaijaz and lucascolley authored Feb 5, 2025
1 parent 82897c9 commit 8dbf5ba
Showing 1 changed file with 91 additions and 55 deletions.
146 changes: 91 additions & 55 deletions content/en/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ The recommended method of installing SciPy depends on your preferred workflow.
The common workflows can roughly be broken down into the following
categories:

- [Project-based (e.g. `uv`, `pixi`)](#project-based) (recommended for new users)
- [Environment-based (e.g. `pip`, `conda`)](#environment-based) (the traditional workflow)
- [System package managers](#system-package-managers) (not recommended)
- [Building from source](#building-from-source) (for debugging and development)
- **Project-based** (e.g. `uv`, `pixi`) _(recommended for new users)_
- **Environment-based** (e.g. `pip`, `conda`) _(the traditional workflow)_
- **System package managers** _(not recommended)_
- **Building from source** _(for debugging and development)_

To install SciPy with [static type stubs],
see [Installing with type stubs](#type-stubs).
Expand All @@ -29,52 +29,56 @@ Installing type stubs may be required for
Interactive Development Environments (IDEs) to provide accurate type hints.
{{< /admonition >}}

<a name="project-based"></a>

## Project-based workflows

### Installing with `uv`
{{< tabs >}}

Here is a step-by-step guide to setting up a project to use SciPy, with [`uv`],
a Python package manager.

[`uv`]: https://docs.astral.sh/uv/
[[tab]]
name = 'Project Based'
content = '''
<a name="project-based"></a>

<!-- prettier-ignore-start -->
### Installing with uv

1. Install `uv`, following [the instructions in the `uv` documentation][install-uv].
Here is a step-by-step guide to setting up a project to use SciPy, with uv, a Python package manager.

[install-uv]: https://docs.astral.sh/uv/getting-started/installation/
1. Install `uv` following, [the instructions in the uv documentation](https://docs.astral.sh/uv/getting-started/installation/).

2. Create a new project in a new subdirectory, by executing the following in a terminal:
2. Create a new project in a new subdirectory, by executing the following in a terminal:

uv init try-scipy
cd try-scipy
```bash
uv init try-scipy
cd try-scipy
```

{{< admonition hint >}}
{{< admonition hint >}}
The second command changes directory into the directory of your project.
{{< /admonition >}}
{{< /admonition >}}

3. Add SciPy to your project:
3. Add SciPy to your project:

uv add scipy
```bash
uv add scipy
```

{{< admonition note >}}
{{< admonition note >}}
This will automatically install Python if you don't already have it installed!
{{< /admonition >}}
{{< /admonition >}}

{{< admonition tip >}}
{{< admonition tip >}}
You can install other Python libraries in the same way, e.g.

uv add matplotlib
```bash
uv add matplotlib
```

{{< /admonition >}}
{{< /admonition >}}

4. Try out SciPy!
4. Try out SciPy!

uv run python
```bash
uv run python
```

This will launch a Python interpreter session, from which you can `import scipy`.
This will launch a Python interpreter session, from which you can `import scipy`.

<!-- prettier-ignore-end -->

Expand Down Expand Up @@ -117,23 +121,30 @@ tool [`pixi`] are very similar to the steps for `uv`:

2. Create a new project in a new subdirectory:

pixi init try-scipy
cd try-scipy
```bash
pixi init try-scipy
cd try-scipy
```

3. Add SciPy to your project:

pixi add scipy
```bash
pixi add scipy
```

4. Try out SciPy!
4. Try out SciPy!

pixi run python
```bash
pixi run python
```

See next steps in [the SciPy user guide][scipy-user-guide].
'''

[[tab]]
name = 'Environment Based'
content = '''
<a name="environment-based"></a>

## Environment-based workflows

In project-based workflows, a project is a directory containing a manifest
file describing the project, a lock-file describing the exact dependencies
of the project, and the project's (potentially multiple) environments.
Expand All @@ -152,14 +163,15 @@ but lack some reproducibility benefits of project-based workflows.

2. Create and activate a virtual environment with `venv`.

{{< admonition hint >}}
{{< admonition hint >}}
See [the tutorial in the Python Packaging User Guide](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments).
{{< /admonition >}}
{{< /admonition >}}

3. Install SciPy, using [`pip`]:

python -m pip install scipy

```bash
python -m pip install scipy
```
<!-- prettier-ignore-end -->

[`pip`]: https://pip.pypa.io/en/stable/getting-started/
Expand All @@ -170,12 +182,19 @@ See [the tutorial in the Python Packaging User Guide](https://packaging.python.o
two Conda-based environment managers.
After creating an environment, you can install SciPy from conda-forge as follows:

conda install scipy # or
mamba install scipy
```bash
conda install scipy # or
mamba install scipy
```

[Miniforge]: https://conda-forge.org/download/

[`mamba`]: https://mamba.readthedocs.io/en/latest/
'''

[[tab]]
name = 'Package Manager'
content = '''
<a name="system-package-managers"></a>

## Installing system-wide via a system package manager
Expand All @@ -189,24 +208,33 @@ installation method.

Using `apt-get`:

sudo apt-get install python3-scipy
```bash
sudo apt-get install python3-scipy
```

### Fedora

Using `dnf`:

sudo dnf install python3-scipy
```bash
sudo dnf install python3-scipy
```

### macOS

macOS doesn't have a preinstalled package manager, but you can install
[Homebrew](https://brew.sh/) and use it to install SciPy (and Python itself):

brew install scipy
```bash
brew install scipy
```

<a name="building-from-source"></a>
'''

## Building from source
[[tab]]
name = 'Building from Source'
content = '''
<a name="building-from-source"></a>

A word of warning: building SciPy from source can be a nontrivial exercise. We
recommend using binaries instead if those are available for your platform
Expand All @@ -216,9 +244,15 @@ For details on how to build from source, see

[building-docs]: https://scipy.github.io/devdocs/building/index.html

'''

{{</ tabs >}}

See next steps in the [SciPy user guide](https://docs.scipy.org/doc/scipy/tutorial/).

<a name="type-stubs"></a>

## Installing with type stubs
## Installing with Type Stubs

Static type stubs are available via a separate package, `scipy-stubs`, on
PyPI and conda-forge.
Expand All @@ -228,10 +262,12 @@ package on conda-forge.
To get a specific version `x.y.z` of SciPy (such as `1.14.1`),
you should install version `x.y.z.*`, for example:

uv add "scipy-stubs[scipy]==1.14.1.*" # or
pixi add "scipy-typed=1.15.0.*" # or
python -m pip install "scipy-stubs[scipy]" # or
conda install "scipy-typed>=1.14"
```bash
uv add "scipy-stubs[scipy]==1.14.1.*" # or
pixi add "scipy-typed=1.15.0.*" # or
python -m pip install "scipy-stubs[scipy]" # or
conda install "scipy-typed>=1.14"
```

Please direct questions about static typing support to
[the `scipy-stubs` GitHub repository](https://github.com/jorenham/scipy-stubs).

0 comments on commit 8dbf5ba

Please sign in to comment.