these notes are only about some fixes I need to do to properly use tensorflow in WSL2 and there was no information about them in the official tutorial
It needs conda to install all the dependencies
python3.9
This workspace was developed using conda and the WSL2 tutorial from tensorflow to use local GPU this tutorial is found at:
https://www.tensorflow.org/install/pip#windows-wsl2
conda create --name tf python=3.9
conda deactivate
conda activate tf
If you do not have anm integrated GPU you can skip the following steps
nvidia-smi
Note the packages cudatoolkit and cudnn are C compiled packages ONLY available with conda they are needed so tensorflow can access the GPU this packages do not exist in the PiPy repository.
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
some packages or dependencies can be missing to solve them
if you find the error:
Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
you will need to enable the paths int the environment
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/python3.8/site-packages/tensorrt/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
and copy the libdevice.10.bc
that was installed in the env, you will need a copy at the same level of the executing file to properly use GPU configs with tensorflow
tutorial:
tensorflow/tensorflow#57679 (comment)
If cuda sdk is not found
sudo apt-get install cuda-toolkit-11-2