Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.43 KB

wsl2-tensorflow-with-tensorrt.md

File metadata and controls

59 lines (41 loc) · 1.43 KB

Installation of Tensorflow in WSL2 (Arch) with Tensorrt

Requirements

Versions (19.02.2023)

  • tensorflow: 2.11.0
  • cudnn: 8.4.1.50
  • cudatoolkit: 11.8.0
  • tensorrt: 8.5.3.1

Installation (Example with Micromamba)

  1. Create .mambarc / .condarc in $HOME

Required if you don't want to type '-c conda-forge' during installation

echo "channels:\n  - conda-forge" > $HOME/.mambarc
  1. Create tf environment & complete conda-forge installs
micromamba env create --name tf python=3.10
micromamba activate tf
micromamba install cudatoolkit cudnn
  1. Set LD_LIBRARY_PATH

The first export prevents you from having to exit and re-enter the environment

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/' > $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
  1. Pip installations
pip install tensorflow
pip install tensorrt
  1. Symlink tensorrt libs to $CONDA_PREFIX/lib/
cd $CONDA_PREFIX/lib
ln -s $CONDA_PREFIX/lib/python3.1/site-packages/tensorrt/libnvinfer.so.8 libnvinfer.so.7
ln -s $CONDA_PREFIX/lib/python3.1/site-packages/tensorrt/libnvinfer_plugin.so.8 libnvinfer_plugin.so.7

Done!