BachiLi / diffvg

Differentiable Vector Graphics Rasterization
https://people.csail.mit.edu/tzumao/diffvg/
Apache License 2.0
964 stars 159 forks source link

Windows installation #6

Open Speido opened 4 years ago

Speido commented 4 years ago

The library compiles without errors under Windows (Windows 10, Python 3.8, torch 1.6, VS2019). However, running examples results in: python single_circle.py Traceback (most recent call last): File "single_circle.py", line 1, in <module> import pydiffvg File "C:\conda\envs\NR\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg\pydiffvg\__init__.py", line 4, in <module> from .render_pytorch import * File "C:\conda\envs\NR\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg\pydiffvg\render_pytorch.py", line 18, in <module> class RenderFunction(torch.autograd.Function): File "C:\conda\envs\NR\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg\pydiffvg\render_pytorch.py", line 27, in RenderFunction filter = pydiffvg.PixelFilter(type = diffvg.FilterType.box, AttributeError: module 'diffvg' has no attribute 'FilterType'

dir(diffvg) ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Any advice?

BachiLi commented 3 years ago

Most likely you didn't install the module properly. Have you run python setup.py install in the corresponding conda environment?

xieMNll commented 3 years ago

I met the same error.
_AttributeError: module 'diffvg' has no attribute 'FilterType'_

I git clone the code, and pip install all requirements. Then I run python setup.py install .

Using c:\programdata\anaconda3\envs\torch\lib\site-packages Finished processing dependencies for diffvg==0.0.1

But when run single_circle.py, it showed ModuleNotFoundError: No module named 'diffvg'. So I copied all diffvg project in my conda environment site_packages. when import pydiffvg, the error occured: File "single_circle.py", line 2, in import pydiffvg File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\diffvg-0.0.1-py3.7-win-amd64.egg\pydiffvg__init__.py", line 4, in from .render_pytorch import * File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\diffvg-0.0.1-py3.7-win-amd64.egg\pydiffvg\render_pytorch.py", line 21, in class RenderFunction(torch.autograd.Function): File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\diffvg-0.0.1-py3.7-win-amd64.egg\pydiffvg\render_pytorch.py", line 30, in RenderFunction filter=pydiffvg.PixelFilter(type=diffvg.FilterType.box, AttributeError: module 'diffvg' has no attribute 'FilterType'

APX403 commented 2 years ago

Same problem on my windows install

d00ML0rDz commented 2 years ago

Renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd seems to have fixed this for me.

IzhanVarsky commented 2 years ago

Renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd seems to have fixed this for me.

Hi, thank you! This helped me to solve the problem "ModuleNotFoundError: No module named 'diffvg'" in "pydiffvg\render_pytorch.py" file. I use win10 with pip.

f2koi commented 1 year ago

Renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd seems to have fixed this for me.

Thanks a lot! I used conda + win10, encountered the same issue as @IzhanVarsky did, and resolved it thanks to your help.