Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ overview/overview_3_features
installation/overview
installation/conda
installation/pip
installation/workspace
installation/acceleration
installation/source
installation/troubleshooting
```
Expand Down
39 changes: 39 additions & 0 deletions docs/installation/acceleration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(installation-acceleration)=

# GPU and optional packages

## JAX and GPUs

The standard installation includes JAX on platforms supported by the package’s dependency markers. A GPU is not required.

For GPU use, follow the [official JAX installation guide](https://docs.jax.dev/en/latest/installation.html) for your hardware, in the same environment as PyAutoLens. Keep JAX compatible with the requirements of your installed PyAuto packages, then check:

```bash
python -m pip check
python -c "import jax; print(jax.devices())"
```

The device list should include your GPU. If it lists only CPU devices, follow JAX’s platform-specific troubleshooting instructions. Native Windows does not support JAX’s NVIDIA GPU installation; consult its WSL2 guidance instead.

On Intel Macs, the PyAuto package markers omit JAX and use the NumPy path. GPU acceleration is not enabled by the standard macOS install.

## Numba

Numba accelerates selected CPU calculations. Install it if your workflow uses those calculations or an example requests it:

```bash
python -m pip install numba
```

It is optional; it is not a prerequisite for every linear-profile or pixelization fit.

## Interferometer calculations

Some interferometer workflows require `nufftax`, particularly the JAX NUFFT path:

```bash
python -m pip install nufftax
python -m pip check
```

The NumPy NUFFT path uses `finufft` on platforms where it is supplied by the package dependencies. Follow the chosen example’s requirements rather than installing every optional package in advance.
118 changes: 20 additions & 98 deletions docs/installation/conda.md
Original file line number Diff line number Diff line change
@@ -1,127 +1,49 @@
(conda)=

# Installation with conda
<span id="installation-with-conda"></span>

## JAX & GPU

**PyAutoLens** runs significantly faster on GPUs — often **50x or more** compared to CPUs.

This acceleration is achieved through \[**JAX**\](<https://docs.jax.dev/en/latest/notebooks/thinking_in_jax.html>), which provides GPU and TPU support.

**JAX is installed by default** — a plain `pip install autolens` includes it (the older
`pip install autolens[jax]` command still works and installs the same thing).

The default install includes **CPU-only** JAX. To ensure GPU acceleration, it is recommended that you install JAX with
GPU support **before** installing **PyAutoLens**, by following the official \[JAX installation guide\](<https://jax.readthedocs.io/en/latest/installation.html>).

If you install **PyAutoLens** without a proper GPU setup, a warning will be displayed.

:::{note}
**Intel Macs**: JAX no longer publishes wheels for Intel (x86_64) macOS, so on these machines
`pip install autolens` automatically installs without JAX and runs on the slower NumPy path — a
warning is printed at import to make this clear. Every other supported platform (Windows, Linux,
Apple-silicon Macs) gets JAX by default.
:::

## Install

Installation via a conda environment circumvents compatibility issues when installing certain libraries. This guide
assumes you have a working installation of [conda](https://conda.io/miniconda.html).

First, update conda:
# Install with conda

```bash
conda update -n base -c defaults conda
```

Next, create a conda environment (we name this `autolens` to signify it is for the **PyAutoLens** install):
Use this route if you have [conda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html), or want it to manage your Python version. Open a terminal with conda available; on Windows, use Anaconda Prompt.

The command below creates this environment with Python 3.12:

```bash
conda create -n autolens python=3.12
```
<span id="install"></span>

Activate the conda environment (you will have to do this every time you want to run **PyAutoLens**):
## Create an environment and install

```bash
conda create -n autolens python=3.12 pip
conda activate autolens
python -m pip install --upgrade pip
python -m pip install autolens
```

We upgrade pip to ensure certain libraries install:
Run `conda activate autolens` each time you open a new terminal to use this environment.

```bash
pip install --upgrade pip
```
For GPU support, follow [GPU setup](acceleration.md) in the same environment.

The latest version of **PyAutoLens** is installed via pip as follows (the command `--no-cache-dir` prevents
caching issues impacting the installation):
## Check the installation

```bash
pip install autolens --no-cache-dir
python -m pip check
python -c "import autolens; print(autolens.__version__)"
```

This includes JAX by default, enabling the acceleration described above. If you need an install without
JAX on a platform where JAX wheels exist (e.g. a restricted environment), install normally and then run
`pip uninstall jax jaxlib` — **PyAutoLens** detects the absence at import and falls back to the fully
supported (but much slower) NumPy path.

If pip prints warnings about dependency version conflicts, these can usually be ignored — the instructions below
will identify clearly if the installation is a success.

If there are no errors **PyAutoLens** is installed!
`pip check` should report no broken requirements, and the second command should print the installed version. Resolve errors using [Troubleshooting](troubleshooting.md) before continuing.

If there is an error check out the [troubleshooting section](https://pyautolens.readthedocs.io/en/latest/installation/troubleshooting.html).
Next, [download the workspace and run an example](workspace.md).

## Workspace

Next, clone the `autolens workspace` (the line `--depth 1` clones only the most recent branch on
the `autolens_workspace`, reducing the download size):

```bash
cd /path/on/your/computer/you/want/to/put/the/autolens_workspace
git clone https://github.com/PyAutoLabs/autolens_workspace --depth 1
cd autolens_workspace
```

Run the `welcome.py` script to get started!

```bash
python3 welcome.py
```

It should be clear that **PyAutoLens** runs without issue.

If there is an error check out the [troubleshooting section](https://pyautolens.readthedocs.io/en/latest/installation/troubleshooting.html).
[Download the workspace and run your first example](workspace.md).

## Numba

Numba (<https://numba.pydata.org>) is an optional library which makes **PyAutoLens** run a lot faster, which we
strongly recommend users have installed.

You can install numba via the following command:

```bash
pip install numba --no-cache-dir
```

Some users have experienced difficulties installing numba, which is why it is an optional library. If your
installation is not successful, you can use **PyAutoLens** without it installed for now, to familiarize yourself
with the software and determine if it is the right software for you.

If you decide that **PyAutoLens** is the right software, then I recommend you commit the time to getting a
successful numba install working, with more information provided [at this readthedocs page](https://pyautolens.readthedocs.io/en/latest/installation/numba.html)
See [Numba and optional CPU acceleration](acceleration.md#numba).

## Optional

For interferometer analysis there is one optional dependency that must be installed via the command:
See [interferometer packages](acceleration.md#interferometer-calculations).

```bash
pip install nufftax
```

**PyAutoLens** will run without these libraries and it is recommended that you only install them if you intend to
do interferometer analysis.
## JAX & GPU

If you run interferometer code a message explaining that you need to install these libraries will be printed, therefore
it is safe not to install them initially.
See [JAX and GPU setup](acceleration.md#jax-and-gpus).
9 changes: 9 additions & 0 deletions docs/installation/numba.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
orphan: true
---

(numba)=

# Numba

Numba is an optional accelerator for selected CPU calculations. See [Numba installation and optional packages](acceleration.md#numba).
45 changes: 20 additions & 25 deletions docs/installation/overview.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
(overview)=

# Overview
<span id="id1"></span>

**PyAutoLens** requires Python 3.12 or later and supports the Linux, MacOS and Windows operating systems.
# Install PyAutoLens

**PyAutoLens** can be installed via the Python distribution [Anaconda](https://www.anaconda.com/) or using
[Pypi](https://pypi.org/) to `pip install autolens` into your Python distribution.
Use Python 3.12 or later in a separate environment. The guides below use Python 3.12.

We recommend Anaconda as it manages the installation of many major libraries (e.g. numpy, scipy,
matplotlib, etc.) making installation more straight forward. Windows users must use Anaconda.
| Your setup | Start here |
| --- | --- |
| You use conda, or need it to manage Python | [Install with conda](conda.md) |
| You already have Python installed | [Install with pip](pip.md) |
| You want to edit the library code | [Install from source](source.md) |

The installation guide for both approaches can be found at:
Both the conda and pip routes install `autolens` from PyPI. A GPU is optional; start with the standard installation, or see [GPU setup](acceleration.md) if you plan to use one.

- [Anaconda installation guide](https://pyautolens.readthedocs.io/en/latest/installation/conda.html)
- [PyPI installation guide](https://pyautolens.readthedocs.io/en/latest/installation/pip.html)
Prefer to try the software without installing it? Open an example in [Google Colab](https://pyautolens.readthedocs.io/en/latest/overview/overview_2_new_user_guide.html).

Users who wish to build **PyAutoLens** from source (e.g. via a `git clone`) should follow
our [building from source installation guide](https://pyautolens.readthedocs.io/en/latest/installation/source.html).
<details>
<summary>Install with help from an AI agent</summary>

## JAX & GPU

**PyAutoLens** runs significantly faster on GPUs — often **50x or more** compared to CPUs.
Paste this into Claude Code, Codex or another AI coding agent:

This acceleration is achieved through \[**JAX**\](<https://docs.jax.dev/en/latest/notebooks/thinking_in_jax.html>), which provides GPU and TPU support.
> Help me install PyAutoLens and set up autolens_workspace. Use the current installation guide at https://pyautolens.readthedocs.io/en/latest/installation/overview.html. Check my operating system and Python version, create an isolated environment, verify the installation and help me run the first example. Ask before changing an existing environment or installing system software.

When you install **PyAutoLens** (see instructions below), JAX will also be installed. However, the default installation may not include GPU support.
The [PyAutoLens AI Assistant](https://github.com/PyAutoLabs/autolens_assistant) can help with the examples once you are set up.

To ensure GPU acceleration, it is recommended that you install JAX with GPU support **before** installing **PyAutoLens**, by following the official \[JAX installation guide\](<https://jax.readthedocs.io/en/latest/installation.html>).
</details>

If you install **PyAutoLens** without a proper GPU setup, a warning will be displayed.
After installing, [run your first example](workspace.md).

## Dependencies

**PyAutoLens** uses the following parent packages:

**PyAutoNerves** <https://github.com/PyAutoLabs/PyAutoNerves>
The installer resolves the required packages automatically. See [optional packages](acceleration.md) for additions needed by particular workflows.

**PyAutoFit** <https://github.com/PyAutoLabs/PyAutoFit>

**PyAutoArray** <https://github.com/PyAutoLabs/PyAutoArray>
## JAX & GPU

**PyAutoGalaxy** <https://github.com/PyAutoLabs/PyAutoGalaxy>
See [JAX and GPU setup](acceleration.md#jax-and-gpus).
Loading
Loading