๐ช Windows Installation Guide for Virtual Sketching
June 12, 2025 ยท View on GitHub
This guide provides step-by-step instructions to set up and run the Virtual Sketching project on Windows using Anaconda and Python 3.6.
โ Requirements
- Windows 10 or newer
- Anaconda installed
- Git installed (optional, but recommended)
๐ฆ Step 1: Create and Activate Conda Environment
conda create -n virtual_sketching python=3.6 -y
conda activate virtual_sketching
๐ Step 2: Clone the Repository
cd D:\
git clone https://github.com/MarkMoHR/virtual_sketching.git
cd virtual_sketching
(If you plan to contribute, consider forking the repo and using your own URL.)
๐ง Step 3: Install Required Packages
From conda:
conda install opencv=3.4.2 pillow=6.2.0 scipy=1.5.2 -y
conda install -c conda-forge pycairo gtk3 cffi -y
Then remove default TensorFlow (if installed via conda):
conda remove tensorflow
Install required packages via pip:
pip install tensorflow==1.15.0
pip install numpy gizeh cairocffi matplotlib svgwrite
โ ๏ธ Do not upgrade
pillow,scipy, ortensorflowโ newer versions are incompatible.
๐ ๏ธ Step 4: Fix Backend Compatibility
In utils.py, near the top, ensure the following:
from PIL import Image
import matplotlib
matplotlib.use('TkAgg') # force compatible backend
import matplotlib.pyplot as plt
This ensures proper rendering with tkinter on Windows.
๐ Step 5: Run a Demo
From the project directory:
python test_vectorization.py --input sample_inputs\muten.png --sample 5
โ ๏ธ This script only generates
.npzand.pngfiles. To convert to.svg, see next section.
๐ผ๏ธ Optional: Use GUI Tool (Windows Only)
Step 1: Launch GUI with provided batch file
Use the runme.bat file to activate the conda environment and launch the Python GUI:
rem runme.bat
set CONDAPATH=C:\ProgramData\anaconda3
set ENVNAME=virtual_sketching
call %CONDAPATH%\Scripts\activate.bat %ENVNAME%
python virtual_sketch_gui.py
pause
Step 2: Select an input image and model
The GUI allows you to:
- Choose input image (PNG, JPEG, BMP, etc.)
- Select one of the three models
- Automatically runs processing and converts results to SVG
- Saves all outputs into a
sketches/subfolder of the input image directory
๐ง Known Compatibility Notes
- Python 3.6 and TensorFlow 1.15 are required (due to use of
tensorflow.contrib) - Windows support requires manual setup of Gizeh and Cairo backends
- GPU usage optional โ TensorFlow 1.15 requires CUDA 10.0 and cuDNN 7
๐งฉ Troubleshooting Tips
- โ
No module named '_cffi_backend'โ Run:conda install -c conda-forge cffi - โ
ImportError: cannot import name 'draw_svg_from_npz'โ Usesvg_conversion.pyinstead - โ
.svglooks wrong โ Make sure you're using the officialsvg_conversion.pyfromtools/ - โ Missing
.svg? โ Usevirtual_sketch_gui.pyor runtools/svg_conversion.pymanually on.npz
๐ค Contributing
Feel free to open issues or pull requests if you encounter bugs or want to improve the Windows support!
๐ Folder Structure Suggestion
virtual_sketching/
โโโ sample_inputs/
โโโ tools/
โโโ outputs/
โโโ virtual_sketch_gui.py
โโโ runme.bat
โโโ README.md
โโโ WINDOWS_INSTALL_GUIDE.md โ You are here
Made with โค๏ธ by the community to help Windows users get started!