Installation
Installation¶
The fastest way of installing this package is through PyPI or Conda:
python3 -m pip install tensorwaves[jax]
And with support for amplitude analysis:
python3 -m pip install tensorwaves[jax,pwa]
conda install -c conda-forge tensorwaves jax jaxlib
And with support for amplitude analysis:
conda install -c conda-forge ampform phasespace
This installs the
latest, stable 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 can be
installed as follows:
python3 -m pip install git+https://github.com/ComPWA/tensorwaves@main
In that case, however, we highly recommend using the more dynamic ‘editable installation’ instead. This goes as follows:
Get the source code:
git clone https://github.com/ComPWA/tensorwaves.git cd tensorwaves
[Recommended] Create a virtual environment (see here).
Install the project as an ‘editable installation’ and install additional packages for the developer:
python3 -m pip install -e .[dev]
Pinning dependency versions
In order to install the exact same versions of the dependencies with which the framework has been tested, use the provided constraints files for the specific Python version
3.x
you are using:python3 -m pip install -c .constraints/py3.x.txt -e .[dev]
See also
That’s all! Have a look at the General examples page to try out the package. You can also have a look at the Help developing page for tips on how to work with this ‘editable’ developer setup!