# WSL2 Installation Failing Miserably

**URL:** <https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192>\
**Category:** General Discussion\
**Tags:** wsl2, install\
**Created:** [April 17, 2023, 2:03am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192 "2023-04-17T02:03:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Mannheimer](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/joshua_mannheimer/32/15432_2.png) [@Joshua\_Mannheimer](https://discuss.ai.google.dev/u/Joshua_Mannheimer)\
**Post date:** [April 17, 2023, 2:03am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/1 "2023-04-17T02:03:19Z")

</div>

I am trying to install Tensorflow using WSL2 on windows as outlined on the TF website  
[Install TensorFlow with pip](https://www.tensorflow.org/install/pip). I get to the point where I am getting confirmation the GPU is registering but I am getting quite a bit of feedback and when I try to train a simple CNN it errors out. I have tried to uninstall and reinstall things using instructions nvidia but still no success. When I try to use other methods to install it doe not recognize the gpu. The first things it spits out is

2023-04-15 22:21:52.990342: I tensorflow/compiler/xla/stream\_executor/cuda/cuda\_gpu\_executor.cc:982] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa\_node  
Your kernel may have been built without NUMA support.

but this seems to just be a warning, the model compiles but when it starts to train

it finally errors out  
2023-04-15 22:21:56.409879: I tensorflow/compiler/xla/stream\_executor/cuda/cuda\_dnn.cc:424] Loaded cuDNN version 8600  
Could not load library libcudnn\_cnn\_infer.so.8. Error: libcuda.so: cannot open shared object file: No such file or directory  
Aborted

Does anybody know how to fix this?

---

<div class="post-metadata">

**Author:** ![chunduriv](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chunduriv](https://discuss.ai.google.dev/u/chunduriv)\
**Post date:** [April 17, 2023, 3:47am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/3 "2023-04-17T03:47:49Z")

</div>

@Joshua_Mannheimer,

Welcome to the Tensorflow Forum!

> [@Joshua\_Mannheimer](#):
>
> Could not load library libcudnn\_cnn\_infer.so.8. Error: libcuda.so: cannot open shared object file: No such file or directory  
> Aborted

Configure the system paths. You can do it with following command everytime your start a new terminal after activating your conda environment.

```auto
CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn. __file__ )"))
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib

```

> When I try to use other methods to install it doe not recognize the gpu.

Could you please elaborate the steps that you have followed to install tensorflow? Also provide System Configuration, GPU Card, cuDNN, CUDA, NVIDIA driver version and CUDA Compute Capability details to debug further?

Thank you!

---

<div class="post-metadata">

**Author:** ![Anton\_Milev](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/anton_milev/32/15355_2.png) [@Anton\_Milev](https://discuss.ai.google.dev/u/Anton_Milev)\
**Post date:** [April 18, 2023, 9:00pm UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/5 "2023-04-18T21:00:20Z")

</div>

Hello, @Joshua_Mannheimer

Did you managed to install tensorflow with GPU on WSL2? I also have similar problems, everything I tried failed. On WSL2 I have tested pytorch with GPU and CUDA Samples so the problem is not with drivers, etc.

|Edition|Windows 11 Pro|  
|Version|21H2|  
|Installed on|‎21/‎11/‎2022|  
|OS build|22000.1574|

My video card is RTX 3060 for notebook.

pip install tensorflow-gpu  
python3 -m pip install nvidia-cudnn-cu11==8.6.0.163 tensorflow==2.12.\*  
pip install --ignore-installed tensorflow\<2.12.0  
pip install --ignore-installed “tensorflow\<2.12.0”  
pip install tensorflow==2.10

Nothing works and each time I end on WSL with Tensorflow installed without the GPU.

This is the full print:

Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import tensorflow as tf  
> > > print("Num GPUs Available: ", len(tf.config.list\_physical\_devices(‘GPU’)))  
> > > 2023-04-18 23:43:25.274791: I tensorflow/core/platform/cpu\_feature\_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX\_VNNI FMA  
> > > To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.  
> > > 2023-04-18 23:43:25.375614: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.  
> > > 2023-04-18 23:43:25.379647: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcudart.so.11.0’; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:25.379678: I tensorflow/stream\_executor/cuda/cudart\_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.  
> > > 2023-04-18 23:43:25.396866: E tensorflow/stream\_executor/cuda/cuda\_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered  
> > > 2023-04-18 23:43:25.830051: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libnvinfer.so.7’; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:25.830118: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libnvinfer\_plugin.so.7’; dlerror: libnvinfer\_plugin.so.7: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:25.830123: W tensorflow/compiler/tf2tensorrt/utils/py\_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.  
> > > print("Num GPUs Available: ", len(tf.config.list\_physical\_devices(‘GPU’)))  
> > > 2023-04-18 23:43:26.418880: I tensorflow/stream\_executor/cuda/cuda\_gpu\_executor.cc:966] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa\_node  
> > > Your kernel may have been built without NUMA support.  
> > > 2023-04-18 23:43:26.418995: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcudart.so.11.0’; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:26.419042: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcublas.so.11’; dlerror: libcublas.so.11: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:26.419081: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcublasLt.so.11’; dlerror: libcublasLt.so.11: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:26.419120: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcufft.so.10’; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:26.447389: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcusparse.so.11’; dlerror: libcusparse.so.11: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:26.447475: W tensorflow/stream\_executor/platform/default/dso\_loader.cc:64] Could not load dynamic library ‘libcudnn.so.8’; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory  
> > > 2023-04-18 23:43:26.447494: W tensorflow/core/common\_runtime/gpu/gpu\_device.cc:1934] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at [Install TensorFlow with pip](https://www.tensorflow.org/install/gpu) for how to download and setup the required libraries for your platform.  
> > > Skipping registering GPU devices…  
> > > Num GPUs Available: 0

---

<div class="post-metadata">

**Author:** ![Joshua\_Mannheimer](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/joshua_mannheimer/32/15432_2.png) [@Joshua\_Mannheimer](https://discuss.ai.google.dev/u/Joshua_Mannheimer)\
**Post date:** [April 18, 2023, 10:24pm UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/6 "2023-04-18T22:24:13Z")

</div>

So I was able to get ii to work the following way  
install everything as laid out in [Install TensorFlow with pip](https://www.tensorflow.org/install/pip) for wsl2.  
Then test if your GPU is being registered with the code they five

```auto
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

```

if this does not read something along the lines of

```auto
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

```

the GPU is not being mapped correctly. Additionally one thing that thru me off initially is that when you download cuDNN 8.6.0 you need to copy the bin, lib, and included files and then paste them into your CUDA 11.8 folder in program files.

once you have completed installation you have to do these extra steps

while on wsl

```auto
 cd /usr/lib/wsl/lib/
then backup files "libcuda.so.1" and "libcuda.so" to something like libcuda.so.backup
then
rm -r libcuda.so.1
rm -r libcuda.so
finally 
ln -s libcuda.so.1.1 libcuda.so.1
ln -s libcuda.so.1.1 libcuda.so
sudo ldconfig

```

once you have done that return to the install page and go to the linux part at the bottom it mentions a fix for ubuntu version 22.04 with the following code

```auto
conda install -c nvidia cuda-nvcc=11.3.58
# Configure the XLA cuda directory
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
printf 'export XLA_FLAGS=--xla_gpu_cuda_data_dir=$CONDA_PREFIX/lib/\n' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
# Copy libdevice file to the required path
mkdir -p $CONDA_PREFIX/lib/nvvm/libdevice
cp $CONDA_PREFIX/lib/libdevice.10.bc $CONDA_PREFIX/lib/nvvm/libdevice/
'''
this is what worked for me but I used python 3.9, tensorflow 2.12, CUDA 11.8 and cuDNN 8.6.0
```

---

<div class="post-metadata">

**Author:** ![Anton\_Milev](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/anton_milev/32/15355_2.png) [@Anton\_Milev](https://discuss.ai.google.dev/u/Anton_Milev)\
**Post date:** [April 19, 2023, 1:11am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/7 "2023-04-19T01:11:27Z")

</div>

I was able to fix my problem. It turns out that tensorfow still depends from CUDA toolkit 11.8 but following the official link I have installed CUDA toolkit 12.

I don’t know if this is the right way but for me the following tutorial worked:

> **[Tensorflow/Pytorch with CUDA on WSL](https://lebaohiep.com/shaare/wEd-8g)**
>
> Follow this instruction from NVIDIA to install CUDA drivers for WSL.
> 
> DO NOT install CUDA Toolkit yet. The version in that instruction is not compatible with current version of Tensorflow/Pytorch.
> 
> Install CUDA Toolkit 11.8.0 for WSL:
> 
> wget...

I stopped at installing tensorflow because I already did this.

Now tensorflow recognizes the GPU, only complains about missing TensorRT.

---

<div class="post-metadata">

**Author:** ![chunduriv](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chunduriv](https://discuss.ai.google.dev/u/chunduriv)\
**Post date:** [April 19, 2023, 6:39am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/9 "2023-04-19T06:39:14Z")

</div>

@Anton_Milev,

According to tested build configurations, tensorflow 2.12 is compatible with CUDA 11.8

 ![image](https://d3qe71uytubmmx.cloudfront.net/original/2X/4/48594f69b3ff704d684f93756d0694c71eb50bef.png)

Thank you!

---

<div class="post-metadata">

**Author:** ![Boris\_Zhu](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/boris_zhu/32/16533_2.png) [@Boris\_Zhu](https://discuss.ai.google.dev/u/Boris_Zhu)\
**Post date:** [May 30, 2023, 12:47pm UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/11 "2023-05-30T12:47:38Z")

</div>

solve my problems, really thank you

---

<div class="post-metadata">

**Author:** ![Gokulakrishnan\_M](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/gokulakrishnan_m/32/17212_2.png) [@Gokulakrishnan\_M](https://discuss.ai.google.dev/u/Gokulakrishnan_M)\
**Post date:** [June 1, 2023, 2:23am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/13 "2023-06-01T02:23:59Z")

</div>

Thanks! It just works!

---

<div class="post-metadata">

**Author:** ![mof](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/mof/32/16257_2.png) [@mof](https://discuss.ai.google.dev/u/mof)\
**Post date:** [June 19, 2023, 3:14am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/15 "2023-06-19T03:14:17Z")

</div>

thanks, been struggling with this for hours

---

<div class="post-metadata">

**Author:** ![Arman\_Hovhannisyan](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/arman_hovhannisyan/32/7429_2.png) [@Arman\_Hovhannisyan](https://discuss.ai.google.dev/u/Arman_Hovhannisyan)\
**Post date:** [October 31, 2023, 9:12am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/17 "2023-10-31T09:12:04Z")

</div>

Hello, I have the same issue with using CNN kayers, while with dense layers there are no issue.I checked your way to fix the problem, but the issue is that i do not have libcuda.so but libcuda.so.1 and libcuda.so.1.1 are existing.What would you suggest to fix problem?

Cudnn version is 8.6.0 and cuda version is 11.8, tensorflow 2.14.0 version.

---

<div class="post-metadata">

**Author:** ![Nikolay\_Penev](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/nikolay_penev/32/17854_2.png) [@Nikolay\_Penev](https://discuss.ai.google.dev/u/Nikolay_Penev)\
**Post date:** [March 26, 2024, 2:49am UTC](https://discuss.ai.google.dev/t/wsl2-installation-failing-miserably/17192/19 "2024-03-26T02:49:33Z")

</div>

> [@chunduriv](#):
>
> ```auto
> CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn. __file__ )"))
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib
> 
> ```

You are a lifesaver sir! Thank you very much!
