diffvg
diffvg copied to clipboard
diffvg / pydiffvg on Colab?
I would be grateful for for an updated Google colab file that shows how to install/compile/run diffvg (if at all possible atm)
All extant colab files floating around on Github/the internet & utilising diffvg AFAIK no longer work due to
- Python version bumps
- broken dependencies
- conda activation changes, ...
- or result in the dreaded "no module pydiffvg"
- or "module 'diffvg' has no attribute 'set_print_timing'"
Some of the previous solutions don't/no longer work on Colab:
- downgrading to Tensorflow 1.x : https://github.com/BachiLi/diffvg/issues/27#issuecomment-1073753730
- renaming some file in (Windows only): https://github.com/BachiLi/diffvg/issues/27#issuecomment-1048905132
- Using condacolab: Shiriluz/Word-As-Image#15
- restarting the runtime after installing diffvg: https://colab.research.google.com/drive/1eGNOIl5fbZ-LoVOgODZ4cILY4wRqU9OK?usp=sharing
- renaming diffvg to pydiffvg (which results in Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j8']' returned non-zero exit status 2.)
Thanks in advance.
I commented out the following line (134) in CMakeLists.txt
on my fork:
find_package(TensorFlow)
Then installing on colab works for me with this cell:
!pip install svgwrite svgpathtools cssutils numba torch-tools visdom drawsvg
%cd /content/
!git clone https://github.com/tristanryerparke/diffvg
%cd diffvg
!git submodule update --init --recursive
!python setup.py install
import os
try:
import pydiffvg
except:
os.kill(os.getpid(), 9)
Keep in mind I'm only using diffvg with pytorch here, but running this cell (sometimes twice) works for me on colab.
good