Complete setup instructions for Windows (including Docker) - liamjones/PaintsChainer-Docker GitHub Wiki

This guide will allow you to run PaintsChainer locally on Windows. It assumes zero knowledge (e.g. you've never heard of or used Docker before).

Docker

Docker allows you to run software containers. Essentially this means the complexity of the software setup, dependencies, etc are taken care of by the creator of the container and you just run a pre-configured copy of the application in it's own little isolated pocket.

If you have Windows 10 Pro or Enterprise it may be worth you investigating using Docker for Windows. This uses HyperV for the containers and may be faster. The route described here has been chosen as it works on more common setups (Windows 7 Home and up).

We're going to be running a Virtual Machine, you'll need VT-X Virtualization support. You probably have this but sometimes you have to turn this on in your BIOS. If you're on Windows 8+ you can open Task Manager and on the Performance -> CPU tab it should say Virtualization: Enabled. If you're on Windows 7 you can download the Microsoft Hardware-Assisted Virtualization Detection Tool and it should say "This computer is configured with hardware-assisted virtualization".

Download and install Docker Toolbox. You can skip the VirtualBox install if you already have a recent copy on your machine. We're also not going to make use of Docker Compose or Git so you can skip those if you only intend to run PaintsChainer locally.

Normally, with other Docker containers, you'd be done at this point but, because PaintsChainer needs more resources than allocated to the VM by default, we're going to have to do a little first run configuration.

From the Start Menu run Docker Quickstart Terminal. This will setup the initial VM in VirtualBox and once it's complete you'll have a terminal prompt you can use. First, we'll shut down the VM again so we can change its configuration. At the prompt type docker-machine stop.

Once stopped, you should close the terminal.

Find Oracle VM VirtualBox in your Start Menu and run it. You should see a VM called default.

Right-click default and choose Settings.

Click System and in the Motherboard tab increase the Base Memory. 4GB is probably enough, you'll see "out of memory" errors later on if it's not and can come back here and increase it further.

While still in Settings -> System click to the Processor tab and increase the number of Processor(s). This isn't strictly necessary, it'll work with a single vCPU but should be faster with more. You probably don't want to allocate the max available as your machine may end up being laggy while PaintsChainer is processing an image.

OK out of Settings and close VirtualBox.

We're now done with the initial Docker setup.

PaintsChainer

To stop you from having to dig into the terminal too much and having to learn commands we're going to use Kitematic, which Docker Toolbox installed, to run the PaintsChainer container.

From the Start Menu run Kitematic (Alpha).

The "Checking Docker" process will almost certainly fail (I believe it's trying to connect to HyperV) and when it does so click Use VirtualBox. You can Skip for now when asked about a Docker Hub login, you won't need one to pull the PaintsChainer container.

If you're only using Kitematic/Docker for PaintsChainer I'd first recommend you go to into Settings (the cog at the bottom left) and turn on Shutdown Linux VM on closing Kitematic to ensure you don't forget to kill the VM and have it chewing resources on your machine when you're finished with PaintsChainer. Click Go back at the top when you're done.

In the search box at the top type paintschainer and it should show a result of liamjones paintschainer-docker. Click Create and it'll start downloading. This may take a while on a slow connection as it's approximately 2GB in size.

Once download has finished you should see a log file as it attempts to start up the container but this will fail with "libcuda.so.1: cannot open shared object file". This is because, on Windows, we can't have GPU passthrough to the container from your host machine so will have to switch PaintsChainer over to the slower CPU mode.

Click Settings at the top right, if you scroll down in the Environment Variables section you should see PAINTSCHAINER_GPU is set to 0, change it to -1 and click Save.

If you now go back to the Home tab at the top right the container should be restarting with the new configuration. This time you should, after a short wait, see serving at 0.0.0.0 : 8000. This means the webserver is ready to serve requests.

Click the first button to the right of Web Preview and you should see a Directory listing in your browser, if you now click into the static/ directory you should be able to use PaintsChainer!

CPU processing is much slower than GPU processing, it may take 30 seconds to a minute for a picture to be coloured rather than the 2 to 5 seconds it would take on GPU.

The log in Kitematic will show errors if PaintsChainer falls over while attempting to process an image.

When you're done you can just close Kitematic and it'll shut down the container and VM (assuming you set the Setting mentioned earlier on).

From this point onward, when you want to use PaintsChainer, you should be able to just launch Kitematic, click paintschainer-docker on the left followed by Start and the launch Web Preview link.