Save yourself from pain and just do this: https://github.com/Auxority/tensorflow-jupyter
- Install any Windows updates that you might have.
- Visit this link or open Geforce Experience.
- Update your drivers to the latest version.
- Visit this link to find the latest download of CUDA Toolkit.
- Install the latest CUDA Toolkit using the installer.
- Add the following to the system path environment variable (click here for more information).:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\extras\CUPTI\lib64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp
- Visit this link for more information about the installation of CUDA Toolkit.
- Visit this link to find the latest zLib downloads.
- Right click the
pre-built zlib DLL
download link forAMD64/Intel EM64T
, and selectSave link as..
to save the zip file to your computer. - Extract the zip file. The folder should contain a
dll_x64
andstatic_x64
directory. - Copy the extracted folder.
- Go to
C:\Program Files\
on your computer using File Explorer. - Create a new directory here called
Zlib
. - Enter the new
Zlib
directory you just created. - Paste the extracted folder you have copied.
- Add the
dll_x64
directory to your system path environment variable (click here for more information).
-
Visit this link to find the latest cuDNN download.
-
You will have to create an account in order to download this.
-
Once you are logged in download the latest Windows zip file.
-
Unzip the cuDNN zip file.
-
Open the extracted folder.
Important note: You must replace 8.x and 8.x.y.z with your specific cuDNN version.
-
Create a directory called
NVIDIA
inC:\Program Files
-
Copy all files from the
bin
directory toC:\Program Files\NVIDIA\CUDNN\v8.x\bin
-
Copy all files from the
include
directory toC:\Program Files\NVIDIA\CUDNN\v8.x\include
-
Copy all files from the
lib
directory toC:\Program Files\NVIDIA\CUDNN\v8.x\lib
-
Add
C:\Program Files\NVIDIA\CUDNN\v8.x\bin
to your system path environment variable. -
Visit this link for more information about the cuDNN SDK installation.
- Visit this link to view Python downloads for Windows.
- Download the Python 3.10.x installer (just select the most recent one).
- Run the installer and make sure to use the checkbox to add Python to your PATH.
- Open your favorite terminal.
- Run
pip install --upgrade pip
to update pip to the latest version.
- Make sure you are running Windows 11.
- Open your favorite terminal.
- Run
wsl --shutdown
to stop all WSL instances. - Run
wsl -l | tail -n +2 | awk '{print $1}' | xargs -I {} wsl --unregister {}
to delete all your WSL instances. - Run
wsl --install
to install WSL2 if this has not been installed. - Run
wsl --install Ubuntu
to install Ubuntu (create a username and password here).
wsl --shutdown
wsl -l | tail -n +2 | awk '{print $1}' | xargs -I {} wsl --unregister {}
wsl --update
wsl --install
- Open your favorite terminal.
- Run
wsl
to enter the Ubuntu instance. - Copy and paste the following commands in WSL to install CUDA:
sudo apt-key del 7fa2af80
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install cuda
- Open your favorite terminal.
- Run
wsl
to enter your Ubuntu instance. - Copy and paste the following commands into your WSL instance to install Miniconda and Tensorflow:
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda create --name tf python=3.9
conda activate tf
conda install -c conda-forge cudatoolkit=11.8.0
python3 -m pip install nvidia-cudnn-cu11==8.6.0.163
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
pip install --upgrade pip
pip install tensorflow==2.12.*
- Verify the tensorflow installation by running
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
in your WSL instance. - For more information visit this website.
- Open your favorite terminal
- Run
wsl --setdefault Ubuntu
to set your Ubuntu instance as your default WSL instance. - Run
wsl
to enter the Ubuntu instance. - Run the following commands to setup your Jupyter server:
conda activate tf
pip install jupyter
jupyter notebook --generate-config
printf "c.NotebookApp.token = 'secret'\nc.NotebookApp.password = ''\nc.NotebookApp.open_browser = False\nc.NotebookApp.ip = '0.0.0.0'\nc.NotebookApp.port = 8888\n" >> ~/.jupyter/jupyter_notebook_config.py
- Run
wsl
to enter your Ubuntu WSL instance. - Run the following commands to start your Jupyter server:
conda activate tf
# Replace YOUR_USERNAME with your own.
jupyter notebook --notebook-dir='/mnt/c/Users/YOUR_USERNAME/Documents/code/python/tensorflow'
- Open Visual Studio Code
- Open a Jupyter Notebook in Visual Studio Code (make sure you have the Python and Jupyter extensions installed).
- Click on
Select Kernel
on the top-right side of the notebook. - Click on
Select Another Kernel...
- Click on
Existing Jupyter Server...
- Click on
Enter the URL of the running Jupyter server
- Copy and paste the following url:
http://localhost:8888?token=secret
and press Enter.