This guide provides step-by-step instructions to set up and run the Virtual Sketching project on Windows using Anaconda and Python 3.6.
- Windows 10 or newer
- Anaconda installed
- Git installed (optional, but recommended)
conda create -n virtual_sketching python=3.6 -y
conda activate virtual_sketchingcd 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.)
conda install opencv=3.4.2 pillow=6.2.0 scipy=1.5.2 -y
conda install -c conda-forge pycairo gtk3 cffi -yconda remove tensorflowpip install tensorflow==1.15.0
pip install numpy gizeh cairocffi matplotlib svgwrite
⚠️ Do not upgradepillow,scipy, ortensorflow— newer versions are incompatible.
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 pltThis ensures proper rendering with tkinter on Windows.
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.
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
pauseThe 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
- 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
- ❌
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
Feel free to open issues or pull requests if you encounter bugs or want to improve the Windows support!
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!