Install
To use TFPWA, we need some dependent packages. There are two main ways,
conda and virtualenv you can choose one of them. Or you can choose other method in 5. Other install method.
1. virtual environment
To avoid conflict of dependence, we recommed to use vitrual environment. there are two main vitrual environment for python packages, conda and virtualenv. You can choose one of them. Since conda include cudatoolkit for gpu, we recommed it for user.
1.1 conda
1.1.1 Get miniconda for python3 from miniconda3 and install it.
1.1.2 Create a virtual environment by
conda create -n tfpwa
, the -n <name> option will create a environment named by <name>. You can also use -p <path> option to create environment in the <path> directory.
1.1.3 You can activate the environment by
conda activate tfpwa
and then you can install packages in the conda environment
1.1.4 You can exit the environment by
conda deactivate
1.2 virtualenv
1.2.1 You should have a python3 first.
1.2.2 Install virtualenv
python3 -m pip install --user virtualenv
1.2.3 Create a virtual environment
python3 -m virtualenv ./tfpwa
, it will store in the path tfpwa
1.2.4 You can activate the environment by
source ./tfpwa/bin/activate
1.2.5 You can exit the environment by
deactivate
2. tensorflow2
The most important package is tensorflow2. We recommed to install tensorflow first. You can following the install instructions in tensorflow website (or tensorflow.org).
2.1 conda
Here we provide the simple way to install tensorflow2 gpu version in conda environment
conda install tensorflow-gpu=2.4
it will also install cudatoolkit.
2.2 virtualenv
When using virtualenv, there is also simple way to install tensorflow2
python -m pip install tensorflow
, but you should check you CUDA installation for GPU.
Note
You can use -i https://pypi.tuna.tsinghua.edu.cn/simple option to use pypi mirror site.
3. Other dependencies
Other dependencies of TFPWA is simple.
3.1 Get TFPWA package
Get the packages using
git clone https://github.com/jiangyi15/tf-pwa
3.2 conda
3.2.1 other dependencies
In conda environment, go into the directory of tf-pwa, you can install rest of the dependencies by
conda install --file requirements-min.txt
Note
we recommend Ampere card users to install with
tensorflow_2_6_requirements.txt (see this
technical FAQ).
conda install --file tensorflow_2_6_requirements.txt -c conda-forge
3.2.2 TFPWA
install TFPWA
python -m pip install -e ./ --no-deps
Use --no-deps to make sure that no PyPI package will be installed.
Using -e, so it can be updated by git pull directly.
3.3 virtualenv
In virtualenv, You can install dependencies and TFPWA together.
python3 -m pip install -e ./
Using -e, so it can be updated by git pull directly.
4. (option) Other dependencies.
There are some optional packages, such as
uprootfor reading root file.
4.1 conda
It can be installed as
conda install uproot -c conda-forge
4.2 virtualenv
It can be installed as
python -m pip install uproot
5. Other install method.
We also provided other install method.
5.1 conda channel (experimental)
A pre-built conda package (Linux only) is also provided, just run the following command to install it.
conda config --add channels jiangyi15
conda install tf-pwa
5.2 pip
When using pip, you will need to install CUDA to use GPU. Just run the
following command :
python3 -m pip install -e .
6. For developer
To contribute to the project, please also install additional developer tools with:
python3 -m pip install -e .[dev]