Installation#
Quick installation#
The fastest way of installing this package is through PyPI or Conda:
python3 -m pip install tensorwaves[jax]
To install the package with support for amplitude analysis run:
python3 -m pip install tensorwaves[jax,pwa]
conda install -c conda-forge tensorwaves jax jaxlib
To install the package with support for amplitude analysis run:
conda install -c conda-forge ampform phasespace
This installs the latest release that
you can find on the stable
branch.
Optional dependencies can be installed as follows:
pip install tensorwaves[pwa] # installs tensorwaves with ampform
pip install tensorwaves[jax,scipy,tf]
pip install tensorwaves[all] # all runtime dependencies
GPU support
Computations with are fastest on a GPU. To get JAX and TensorFlow work with your graphics card, you need to install at least CUDA Toolkit 11.2 and cuDNN 8.1.
Below is an installation guide for installing TF and JAX with GPU support. These instructions may become outdated, so refer to this TF page an these JAX instructions if you run into trouble.
Download and install CUDA Toolkit 11.x by following these platform-dependent instructions. There may be dependency conflicts with existing NVIDIA packages. In that case, have a look here.
Tell the system where to find CUDA. In Ubuntu (or WSL-Ubuntu), this can be done by adding the following line to your
.bashrc
file:export PATH="$PATH:/usr/local/cuda/bin"
But first, check if
/usr/local/cuda/bin
indeed exists!Restart your machine. Then, launch a terminal to check whether CUDA is installed:
nvcc --version
Download and install cuDNN following these instructions. Make sure that you download cuDNN for CUDA 11.x!
In Ubuntu (Debian), there are two convenient options: (1) installing through
apt
or (2) using a local installer. You may need to create an NVIDIA account.[Recommended] Install JAX with GPU binaries in your virtual environment following these instructions.
pip install --upgrade jax[cuda] jaxlib -f https://storage.googleapis.com/jax-releases/jax_releases.html
It doesnāt matter whether you do this before or after installing TensorWaves.
If TensorFlow can correctly find your GPU, the following should return a non-empty list:
python3 -c 'import tensorflow as tf; print(tf.config.list_physical_devices("GPU"))'
If JAX can correctly find your GPU, the following should return
gpu
:python3 -c 'from jax.lib import xla_bridge; print(xla_bridge.get_backend().platform)'
The latest version on the main
branch (or any other branch, tag, or commit) can be installed as follows:
python3 -m pip install git+https://github.com/ComPWA/tensorwaves@main
Or, with optional dependencies:
python3 -m pip install "tensorwaves[jax,pwa] @ git+https://github.com/ComPWA/tensorwaves@main"
Editable installation#
If you are working on amplitude analysis, we highly recommend using the more dynamic āeditable installationā instead. This allows you to:
exactly pin all dependencies to a specific version, so that your work is reproducible.
edit the source code of the framework and help improving it.
For this, you first need to get the source code with Git:
git clone https://github.com/ComPWA/tensorwaves.git
cd tensorwaves
Next, you install the project in editable mode with either
Conda or pip
. Itās
recommended to use Conda, because this also pins the version of Python.
conda env create
This installs the project in a Conda environment following the definitions in
environment.yml
.
[Recommended] Create a virtual environment with
venv
(see here).Install the project as an āeditable installationā with additional packages for the developer and all dependencies pinned through constraints files:
python3 -m pip install -c .constraints/py3.x.txt -e .[dev]
See Updating for how to update the dependencies when new commits come in.
Thatās all! Have a look at General examples to try out the package. You can also have a look at Help developing for tips on how to work with this āeditableā developer setup!