Installing XRTpy

Installing Python

XRTpy requires Python 3.9 or newer. If you do not have Python installed already, here are the instructions to download Python and install it.

Tip

New versions of Python are released annually in October, and it can take a few months for the scientific Python ecosystem to catch up. If you have trouble installing xrtpy on the most recent Python version between October and ∼March, then try installing it on the second most recent version.

Installing XRTpy with pip

To install the most recent release of xrtpy on PyPI with pip into an existing Python 3.9+ environment on macOS or Linux, open a terminal and run:

python -m pip install xrtpy

On some systems, it might be necessary to specify the Python version number by using python3, python3.9, python3.10, or python3.11 instead of python.

To install XRTpy on Windows, run:

py -3.10 -m pip install xrtpy

The version of Python may be changed from 3.10 to another supported Python 3.9+ release that has been installed on your computer.

For more detailed information, please refer to this tutorial on installing packages.

Installing XRTpy with Conda

Conda is a package management system and environment manager that is commonly used in the scientific Python ecosystem. Conda lets us create and switch between Python environments that are isolated from each other and the system installation. Conda can also be used for packages written in languages other than Python.

After installing Conda or miniconda, xrtpy can be installed into an activated Conda environment by opening a terminal and running:

conda install -c conda-forge xrtpy

Here -c conda-forge indicates that xrtpy should be installed from the conda-forge channel.

To install xrtpy into another existing Conda environment, append -n env_name to the previous command, where env_name is replaced with the name of the environment.

To create a new environment with xrtpy installed in it, run:

conda create -n env_name -c conda-forge xrtpy

where env_name is replaced by the name of the environment. To activate this environment, run:

conda activate env_name

To update xrtpy to the most recent version within a currently activated Conda environment, run:

conda update xrtpy

Tip

Creating a Conda environment can sometimes take a few minutes. If it takes longer than that, try updating to the newest version of Conda with conda update conda or checking out these tips for improving Conda performance.

Installing XRTpy with Anaconda Navigator

Note

This section contains instructions on how to install XRTpy with Anaconda Navigator at the time of writing. For the most up-to-date information, please go to the official documentation on installing Anaconda Navigator and managing packages.

Anaconda Navigator is a graphical user interface (GUI) for Conda that can be used to install Python packages. It is installed automatically with newer versions of Conda. If you are using Miniconda or a different Conda environment, you can install it with conda install anaconda-navigator. After that it can be opened by entering anaconda-navigator in the terminal.

First, go to the Environments tab and select Channels. If conda-forge is not listed, then go to Add, enter https://conda.anaconda.org/conda-forge, and click on Update channels and then Update index.

Next, while on the Environments tab, select the environment that you would like to install xrtpy in. The default is generally base (root). Optionally, you may select Create to start a new environment. In the search bar, enter xrtpy. Click on the checkbox next to xrtpy, and select Apply to begin the installation process.

To test the installation, click on the icon that should be present next to the activated environment, and select Open terminal. Enter python in the terminal, and then import xrtpy to make sure it works.

Installing XRTpy from source code

Obtaining official releases

A ZIP file containing the source code for official releases of xrtpy can be obtained from PyPI or from Zenodo.

Alternatively, official releases can be downloaded from the releases page on XRTpy’s GitHub repository.

Obtaining source code from GitHub

If you have git installed on your computer, you may clone XRTpy’s GitHub repository and access the source code from the most recent development version by running:

git clone https://github.com/xrtpy/xrtpy.git

The repository will be cloned inside a new subdirectory called xrtpy.

If you do not have git installed on your computer, then you may download the most recent source code from XRTpy’s GitHub repository by going to Code and selecting Download ZIP. Unzipping the file will create a subdirectory called XRTpy that contains the source code.

Building and installing

To install the downloaded version of xrtpy, enter the xrtpy directory and run:

pip install .

If you expect to occasionally edit the source code, instead run:

pip install -e .[developer]

The -e flag makes the installation editable and [developer] indicates that all of the dependencies needed for developing XRTpy will be installed.

Note

If you noticed any places where the installation instructions could be improved or have become out of date, please create an issue on XRTpy’s GitHub repository. It would really help!