diffvg icon indicating copy to clipboard operation
diffvg copied to clipboard

module 'diffvg' has no attribute 'FilterType_'

Open xieMNll opened this issue 3 years ago • 9 comments

!!!I met the same error @BachiLi ,and I really need your help.
AttributeError: module 'diffvg' has no attribute 'FilterType'

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

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

But when I 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'

My environment: windows10 Anaconda3 python3.7

xieMNll avatar Aug 09 '21 02:08 xieMNll

It's possible you have a diffvg directory present in the scope that you're running your program, so it's looking there for the attribute and not finding it. After installing, try renaming diffvg to temp_diffvg or something else; that cleared up this problem for me. (Running in a Colab notebook, not Windows.)

robinsloan avatar Oct 02 '21 18:10 robinsloan

this didn't work for me. the only environment that works is python 3.6 for some reason. Every other fresh build of python yields extern errors for Cuda on the build. this builds but can't find diffvg.

bfrasure avatar Oct 04 '21 22:10 bfrasure

It's the FilterType here, it doesn't exist on which ever version it's importing.

                        filter = pydiffvg.PixelFilter(type = diffvg.FilterType.box,
                                                      radius = torch.tensor(0.5)),

firebellys avatar Dec 03 '21 06:12 firebellys

same error

APX403 avatar Dec 07 '21 02:12 APX403

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.

d00ML0rDz avatar Feb 23 '22 15:02 d00ML0rDz

I faced the same problems and made some changes until it worked on the Google Colab.

  1. Down grade Tensorflow to version 1.X. %tensorflow_version 1.x import tensorflow as tf print(tf.__version__)

  2. Add "pydiffvg" path to c compiled file? import sys sys.path.append("/content/CLIPasso/diffvg/build/lib.linux-x86_64-3.7")

  3. Upgrade Pillow. !pip3 install --upgrade Pillow

jam411 avatar Mar 21 '22 10:03 jam411

If you are working on Google Colab, try restarting the runtime after installing diffvg, that worked for me!

David-Estevez avatar Jul 27 '22 13:07 David-Estevez

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.

I have no idea why but this solved it for me!

Gaspa79 avatar Aug 02 '22 17:08 Gaspa79

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 @d00ML0rDz, It work for me.

SoundmartellTutorials avatar Oct 14 '22 08:10 SoundmartellTutorials