From 1a0385a4511ebff9b870adffcb8d78a032fd0372 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 12 Nov 2026 18:58:57 +0000 Subject: [PATCH] docs: simplify installation guides and preserve existing anchors --- docs/index.md | 2 + docs/installation/acceleration.md | 39 ++++++ docs/installation/conda.md | 118 +++--------------- docs/installation/numba.md | 9 ++ docs/installation/overview.md | 45 +++---- docs/installation/pip.md | 138 +++++---------------- docs/installation/source.md | 178 +++++---------------------- docs/installation/troubleshooting.md | 88 ++++++------- docs/installation/workspace.md | 35 ++++++ 9 files changed, 230 insertions(+), 422 deletions(-) create mode 100644 docs/installation/acceleration.md create mode 100644 docs/installation/numba.md create mode 100644 docs/installation/workspace.md diff --git a/docs/index.md b/docs/index.md index 53dc75c39..c618ce4c1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -77,6 +77,8 @@ overview/overview_3_features installation/overview installation/conda installation/pip +installation/workspace +installation/acceleration installation/source installation/troubleshooting ``` diff --git a/docs/installation/acceleration.md b/docs/installation/acceleration.md new file mode 100644 index 000000000..4e69b8225 --- /dev/null +++ b/docs/installation/acceleration.md @@ -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. diff --git a/docs/installation/conda.md b/docs/installation/conda.md index 3497e0a56..214e5f394 100644 --- a/docs/installation/conda.md +++ b/docs/installation/conda.md @@ -1,127 +1,49 @@ (conda)= -# Installation with conda + -## JAX & GPU - -**PyAutoLens** runs significantly faster on GPUs — often **50x or more** compared to CPUs. - -This acceleration is achieved through \[**JAX**\](), 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\](). - -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 -``` + -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 () 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). diff --git a/docs/installation/numba.md b/docs/installation/numba.md new file mode 100644 index 000000000..dbc6e164d --- /dev/null +++ b/docs/installation/numba.md @@ -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). diff --git a/docs/installation/overview.md b/docs/installation/overview.md index be8178580..a3fd9ef77 100644 --- a/docs/installation/overview.md +++ b/docs/installation/overview.md @@ -1,43 +1,38 @@ (overview)= -# Overview + -**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). +
+Install with help from an AI agent -## 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**\](), 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\](). +
-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** +The installer resolves the required packages automatically. See [optional packages](acceleration.md) for additions needed by particular workflows. -**PyAutoFit** - -**PyAutoArray** +## JAX & GPU -**PyAutoGalaxy** +See [JAX and GPU setup](acceleration.md#jax-and-gpus). diff --git a/docs/installation/pip.md b/docs/installation/pip.md index 350c43187..669baf0c2 100644 --- a/docs/installation/pip.md +++ b/docs/installation/pip.md @@ -1,145 +1,65 @@ (pip)= -# Installation with pip + -:::{note} -**PyAutoLens** requires **Python 3.12 or later**. On Python 3.9, 3.10 or 3.11, -`pip install autolens` stops with an error telling you to upgrade — it will not -quietly install an older release instead. Upgrade Python to 3.12+ before -installing. -::: +# Install with pip -## JAX & GPU - -**PyAutoLens** runs significantly faster on GPUs — often **50x or more** compared to CPUs. - -This acceleration is achieved through \[**JAX**\](), 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\](). +Use an isolated environment so this installation does not change packages used by your other projects. -If you install **PyAutoLens** without a proper GPU setup, a warning will be displayed. +## Create an environment -:::{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 - -We strongly recommend that you install **PyAutoLens** in a -[Python virtual environment](https://www.geeksforgeeks.org/python-virtual-environment/), with the link attached -describing what a virtual environment is and how to create one. - -We upgrade pip to ensure certain libraries install: +On Linux or macOS, with Python 3.12 installed: ```bash -pip install --upgrade pip +python3.12 -m venv autolens-env +source autolens-env/bin/activate ``` -The latest version of **PyAutoLens** is installed via pip as follows: +On Windows, in Command Prompt: -```bash -pip install autolens +```bat +py -3.12 -m venv autolens-env +autolens-env\Scriptsctivate.bat ``` -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 remove it: +If you use a different supported Python version, substitute it in the environment-creation command. See [Python’s environment guide](https://docs.python.org/3/library/venv.html) for other shells, including PowerShell. + +## Install ```bash -pip uninstall jax jaxlib +python -m pip install --upgrade pip +python -m pip install autolens ``` -**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. +For GPU support, follow [GPU setup](acceleration.md) in the same environment. -If there are no errors **PyAutoLens** is installed! - -If there is an error check out the [troubleshooting section](https://pyautolens.readthedocs.io/en/latest/installation/troubleshooting.html). - -## Workspace - -Next, clone the `autolens workspace` (the line `--depth 1` clones only the most recent branch on -the `autolens_workspace`, reducing the download size): +## Check the installation ```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 +python -m pip check +python -c "import autolens; print(autolens.__version__)" ``` -Run the `welcome.py` script to get started! +`pip check` should report no broken requirements, and the second command should print the installed version. Resolve errors using [Troubleshooting](troubleshooting.md) before continuing. -```bash -python3 welcome.py -``` +Next, [download the workspace and run an example](workspace.md). -It should be clear that **PyAutoLens** runs without issue. +## Workspace -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 () 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 -``` - -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: - -```bash -pip install nufftax -``` +See [interferometer packages](acceleration.md#interferometer-calculations). -**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). ## Legacy Python versions -We dropped support for Python 3.9, 3.10 and 3.11 in release `2026.7.29.2` -(July 2026) — the first release published declaring `Requires-Python >=3.12`. - -Raising that floor does not retract what is already published. Releases at or -below `2026.7.29.1` were published declaring `>=3.9`, and PyPI metadata is -immutable, so they remain valid candidates forever. Left alone, `pip install -autolens` on an older Python did not fail — it walked back to `2026.7.29.1` and -installed a months-old stack without JAX, reporting nothing. - -Release `2026.7.29.1.post1` exists to stop that. It contains no code, declares -`Requires-Python <3.12`, and raises an error when pip tries to build it, so an -unsupported Python gets an explanation instead of a stale install. - -If you need a historical release, pin it exactly — that still resolves on older -Pythons: - -```bash -pip install autolens==2025.10.6.1 -``` - -One gap remains: `pip install --only-binary=:all: autolens` skips source -distributions entirely, so it steps past `2026.7.29.1.post1` and installs the -old wheel silently. If you use that flag, pin the version you want. +See [older Python versions](troubleshooting.md#older-python-versions). diff --git a/docs/installation/source.md b/docs/installation/source.md index 87c391845..6c9681646 100644 --- a/docs/installation/source.md +++ b/docs/installation/source.md @@ -1,173 +1,59 @@ (source)= -# Building From Source + -## JAX & GPU - -**PyAutoLens** runs significantly faster on GPUs — often **50x or more** compared to CPUs. - -This acceleration is achieved through \[**JAX**\](), which provides GPU and TPU support. - -When you install **PyAutoLens** (see instructions below), JAX will also be installed. However, the default installation may not include GPU support. - -To ensure GPU acceleration, it is recommended that you install JAX with GPU support **before** installing **PyAutoLens**, by following the official \[JAX installation guide\](). - -If you install **PyAutoLens** without a proper GPU setup, a warning will be displayed. - -## Packages - -Building from source means that you clone (or fork) the **PyAutoLens** GitHub repository and run **PyAutoLens** from -there. Unlike `conda` and `pip` this provides a build of the source code that you can edit and change, to -contribute the development **PyAutoLens** or experiment with yourself! - -A large amount of **PyAutoLens** functionality is contained in its parent projects: - -**PyAutoFit** - -**PyAutoArray** - -**PyAutoGalaxy** - -If you wish to build from source all code you may need to build from source these 3 additional -projects. We include below instructions for building just **PyAutoLens** from source or building all projects. - -## Building Only PyAutoLens - -We upgrade pip to ensure certain libraries install: - -```bash -pip install --upgrade pip -``` - -First, clone (or fork) the **PyAutoLens** GitHub repository: - -```bash -git clone https://github.com/PyAutoLabs/PyAutoLens -``` - -Next, install the **PyAuto** parent projects via pip: - -```bash -pip install autonerves -pip install autofit -pip install autoarray -pip install autogalaxy -``` - -Next, install the **PyAutoLens** dependencies via pip: - -```bash -pip install -r PyAutoLens/requirements.txt -``` - -Next, install the optional dependency numba via pip (see [this link](https://pyautolens.readthedocs.io/en/latest/installation/numba.html) for a description of numba): - -```bash -pip install numba -``` + -For unit tests to pass you will also need the following optional requirements: +# Install from source -```bash -pip install nufftax -``` +Use this route when you want to edit PyAutoLens. For running examples, use [conda](conda.md) or [pip](pip.md). -If you are using a `conda` environment, add the source repository as follows: + -\[NOTE: Certain versions of conda use the command `conda develop` (without a dash) instead of those shown below.\] +## Edit PyAutoLens -```bash -conda-develop PyAutoLens -``` - -Alternatively, if you are using a Python environment include the **PyAutoLens** source repository in your PYTHONPATH -(noting that you must replace the text `/path/to` with the path to the **PyAutoLens** directory on your computer): +In an active Python environment: ```bash -export PYTHONPATH=$PYTHONPATH:/path/to/PyAutoLens +git clone https://github.com/PyAutoLabs/PyAutoLens.git +cd PyAutoLens +python -m pip install --upgrade pip +python -m pip install -e ".[dev]" +python -m pip check +python -c "import autolens; print(autolens.__file__)" ``` -Finally, check the **PyAutoLens** unit tests run and pass (you may need to install pytest via `pip install pytest`): +An editable install uses the code in your checkout. Dependencies are installed from PyPI; you do not need `conda-develop` or a manual `PYTHONPATH` entry. The printed path should point into your checkout. -```bash -cd /path/to/PyAutoLens -python3 -m pytest -``` + -## Building All Projects +## Edit several PyAuto libraries -We upgrade pip to ensure certain libraries install: +If your change also touches a parent library, install those checkouts together. From a folder containing none of these repositories yet: ```bash -pip install --upgrade pip +git clone https://github.com/PyAutoLabs/PyAutoNerves.git +git clone https://github.com/PyAutoLabs/PyAutoFit.git +git clone https://github.com/PyAutoLabs/PyAutoArray.git +git clone https://github.com/PyAutoLabs/PyAutoGalaxy.git +git clone https://github.com/PyAutoLabs/PyAutoLens.git +python -m pip install -e ./PyAutoNerves -e ./PyAutoFit -e ./PyAutoArray -e ./PyAutoGalaxy -e ./PyAutoLens +python -m pip check ``` -First, clone (or fork) all 4 GitHub repositories: +Use compatible branches or release tags across the repositories. A development branch can depend on changes that are not yet published. -```bash -git clone https://github.com/PyAutoLabs/PyAutoFit -git clone https://github.com/PyAutoLabs/PyAutoArray -git clone https://github.com/PyAutoLabs/PyAutoGalaxy -git clone https://github.com/PyAutoLabs/PyAutoLens -``` - -Next, install **PyAutoNerves** via pip: - -```bash -pip install autonerves -``` +## Run tests -Next, install the source build dependencies of each project via pip: +From the PyAutoLens checkout: ```bash -pip install -r PyAutoFit/requirements.txt -pip install -r PyAutoArray/requirements.txt -pip install -r PyAutoGalaxy/requirements.txt -pip install -r PyAutoLens/requirements.txt +python -m pip install -e ".[dev]" +python -m pytest test_autolens/ ``` -Next, install the optional dependency numba via pip (see [this link](https://pyautolens.readthedocs.io/en/latest/installation/numba.html) for a description of numba): - -```bash -pip install numba -``` +Some tests need additional packages or test data; follow the repository’s contributor instructions for the full test environment. -For unit tests to pass you will also need the following optional requirements: - -```bash -pip install -r PyAutoArray/optional_requirements.txt -``` - -If you are using a `conda` environment, add each source repository as follows: - -\[NOTE: Certain versions of conda use the command `conda develop` (without a dash) instead of those shown below.\] - -```bash -conda-develop PyAutoFit -conda-develop PyAutoArray -conda-develop PyAutoGalaxy -conda-develop PyAutoLens -``` - -Alternatively, if you are using a Python environment include each source repository in your PYTHONPATH -(noting that you must replace the text `/path/to` with the path to the each directory on your computer): - -```bash -export PYTHONPATH=$PYTHONPATH:/path/to/PyAutoFit -export PYTHONPATH=$PYTHONPATH:/path/to/PyAutoArray -export PYTHONPATH=$PYTHONPATH:/path/to/PyAutoGalaxy -export PYTHONPATH=$PYTHONPATH:/path/to/PyAutoLens -``` - -Finally, check the unit tests run and pass for each project (you may need to install pytest via `pip install pytest`): +## JAX & GPU -```bash -cd /path/to/PyAutoFit -python3 -m pytest -cd ../PyAutoArray -python3 -m pytest -cd ../PyAutoGalaxy -python3 -m pytest -cd ../PyAutoLens -python3 -m pytest -``` +See [JAX and GPU setup](acceleration.md#jax-and-gpus). diff --git a/docs/installation/troubleshooting.md b/docs/installation/troubleshooting.md index 24b73b235..ef6632588 100644 --- a/docs/installation/troubleshooting.md +++ b/docs/installation/troubleshooting.md @@ -2,70 +2,70 @@ # Troubleshooting -## Pip Version + -If an error message appears after trying to run `pip install autolens` first make sure you are using -the latest version of pip. + + +## Check the active environment + +Run these commands in the terminal where installation or execution failed: ```bash -pip install --upgrade pip -pip3 install --upgrade pip +python --version +python -m pip --version +python -m pip check ``` -## Pip / Conda +Use Python 3.12 or later. If pip reports conflicting dependencies, resolve them or retry in a fresh environment. Do not ignore the conflict and assume the installation is complete. -If you are trying to [install via pip](https://pyautolens.readthedocs.io/en/latest/installation/pip.html) but -still having issues, we recommend you try to [install via conda](https://pyautogalaxy.readthedocs.io/en/latest/installation/conda.html) -instead, or visa versa. +For a pip installation error, update pip in that environment and retry: -## Community & Support +```bash +python -m pip install --upgrade pip +python -m pip install autolens +``` -Questions, help with your code or your analysis, and ideas: the -[PyAutoLabs Discussions](https://github.com/orgs/PyAutoLabs/discussions). -Bug reports with a reproducer (a snippet, the traceback, your versions): -an issue on the library's tracker. The Slack is for collaborators, by -invitation. + -## Current Working Directory +## Missing files when running examples -**PyAutoLens** scripts assume that the `autolens_workspace` directory is the Python working directory. This means -that, when you run an example script, you should run it from the `autolens_workspace` as follows: +Run scripts from the workspace root, not from inside a scripts subfolder: ```bash -cd path/to/autolens_workspace (if you are not already in the autolens_workspace). -python3 examples/model/beginner/mass_total__source_lp.py +cd path/to/autolens_workspace +python scripts/imaging/start_here.py ``` -The reasons for this are so that **PyAutoLens** can: - -> - Load configuration settings from config files in the `autolens_workspace/config` folder. -> - Load example data from the `autolens_workspace/dataset` folder. -> - Output the results of models fits to your hard-disk to the `autolens/output` folder. +Replace `path/to/autolens_workspace` with your workspace location. Check that the dataset required by the example is present; a missing file is not always a working-directory problem. -If you have any errors relating to importing modules, loading data or outputting results it is likely because you -are not running the script with the `autolens_workspace` as the working directory! +## Workspace and package versions -## Matplotlib Backend - -Matplotlib uses the default backend on your computer, as set in the config file: +A checkout of the workspace’s `main` branch can be newer than your installed library. Check your version: ```bash -autolens_workspace/config/visualize/general.yaml +python -c "import autolens; print(autolens.__version__)" ``` -If unchanged, the backend is set to 'default', meaning it will use the backend automatically set up for Python on -your system. +Use a workspace release tag matching that version where available, or update to a compatible published library/workspace pair. Do not change API calls just to work around an unexplained version mismatch. -```bash -general: - backend: default -``` + -There have been reports that using the default backend causes crashes when running the test script below (either the -code crashes without a error or your computer restarts). If this happens, change the config's backend until the test -works (TKAgg has worked on Linux machines, Qt5Agg has worked on new MACs). For example: +## Plot windows do not open -```bash -general: - backend: TKAgg -``` +Check whether your Python session has access to a graphical desktop. On a remote or headless machine, save figures to files instead of opening windows. + +The workspace setting is `config/visualize/general.yaml` → `general` → `backend`. See [Matplotlib’s backend guide](https://matplotlib.org/stable/users/explain/figure/backends.html) before choosing a backend; interactive backends require their corresponding GUI packages. + +## GPU not detected + +See [GPU setup](acceleration.md) and check the output of `jax.devices()`. + +## Older Python versions + +Use a new environment with Python 3.12 or later for current releases. If you need a historical version, pin that version explicitly and use its corresponding documentation. + + + +## Get help + +Post in [PyAutoLabs Discussions](https://github.com/orgs/PyAutoLabs/discussions) with your operating system, Python and package versions, the command you ran, and the complete traceback. diff --git a/docs/installation/workspace.md b/docs/installation/workspace.md new file mode 100644 index 000000000..5cf50cb20 --- /dev/null +++ b/docs/installation/workspace.md @@ -0,0 +1,35 @@ +(installation-workspace)= + +# Run your first example + +The [autolens_workspace](https://github.com/PyAutoLabs/autolens_workspace) contains example scripts, notebooks and configuration files. With your installation environment active, download it into a folder of your choice: + +```bash +git clone --depth 1 https://github.com/PyAutoLabs/autolens_workspace.git +cd autolens_workspace +python welcome.py +``` + +This requires [Git](https://git-scm.com/downloads). The welcome script checks the setup and opens example plots; close each plot window when prompted to continue. + +Run workspace scripts from this directory so they can find their configuration and data files. + +## Choose your next step + +- Read [start_here.ipynb](https://github.com/PyAutoLabs/autolens_workspace/blob/main/start_here.ipynb) for an introduction to the Python API. +- Run the same walkthrough as a Python script: + +```bash +python start_here.py +``` + +- Use the [New User Guide](https://pyautolens.readthedocs.io/en/latest/overview/overview_2_new_user_guide.html) to choose an example for your observations. + +To run notebooks locally, install and launch JupyterLab in this environment: + +```bash +python -m pip install jupyterlab +python -m jupyter lab +``` + +If a workspace example reports a missing API, see [version mismatches](troubleshooting.md#workspace-and-package-versions).