How to install PWC-Net and Ubuntu on Windows 11

Where to start?

Rick
3 min readApr 30, 2024

It might be easier if you don’t have any other version of CUDA installed or any other Ubuntu subsystem. If you do, and the installations you currently have are essential to whatever work you need to do, start by installing the most problematic library in this case, which is CuPy.

Before getting into anything else, let’s check out the version od PWC-Net I’ll use:

In my experience, the problematic library is CuPy. According to the requirements file you’ll need at least CuPy 5.0

Looking at the minimum pytorch version which is 1.6.0, we need CUDA 10.1. However the CuPy page shows the min requirements for CUDA

So 10.1 is a no go. Just because I’d like to not have to mess with uninstalling and installing again for a future project, I’m going to choose CUDA 11.8 and it’s corresponding pytorch version (2.2.2)

Now that we decided on the versions, let’s make sure no cuda is installed. Or check what CUDA version is compatible with the necesary CuPy version.

check cuda install

~$ nvidia-smi 

If you are working in windows the same command will work to check if it exist. If it does, uninstall CUDA like you would any other program.

Start installing

if you have a “clean slate” start by installing ubuntu 18.04 or 22.04 from the microsoft store

Once you have, let’s install Anaconda to keep am organized environment. You can follow this Digital Ocean article on how to install it easily.

Now we can create an environment with the following command:

~$ conda create --name pwcnet

and the following command to enter the environment:

~$ conda activate pwcnet

if you forgot the name of your installation

~$ conda env list

Install CUDA 11.8

I’m not gonna cover it for windows since it’s just clicking to the next stage. For ubuntu or any other Linux distribution you’d like, follow the steps presented on the official page for CUDA 11.8

follow this video for reference

Check CUDA Install

reboot and check installation

Install CuPy

~$ pip3 install cupy

Install PyTorch and the rest of dependencies

~$ pip3 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu118
~$ pip3 install pillow

Clone github and test the code

~$ git clone https://github.com/sniklaus/pytorch-pwc.git
~$ cd pytorch-pwc

once it’s done, run this command

~$ python run.py --model default --one ./images/one.png --two ./images/two.png --out ./out.flo

--

--

Rick
Rick

Written by Rick

I blog about everything I learn, Digital Image Processing, Data Science, IoT, Videogame design and much more :)

No responses yet