BachiLi / diffvg

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

Windows Diffvg missing module #12

Closed ib0b closed 2 years ago

ib0b commented 3 years ago

Environment

Windows 10 , Python Version 3.7.4

Problem

After installation using python setup install I get this

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

But when running the example single circle i get this

(base) D:\GitHub\AI projects\diffvg\apps>python single_circle.py
Traceback (most recent call last):
  File "single_circle.py", line 1, in <module>
    import pydiffvg
  File "C:\ProgramData\Anaconda3\lib\site-packages\diffvg-0.0.1-py3.7-win-amd64.egg\pydiffvg\__init__.py", line 4, in <module>
    from .render_pytorch import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\diffvg-0.0.1-py3.7-win-amd64.egg\pydiffvg\render_pytorch.py", line 2, in <module>
    import diffvg
ModuleNotFoundError: No module named 'diffvg'

Testing if diffvg is available:

(base) D:\GitHub\AI projects\diffvg\apps>python -c "import diffvg"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'diffvg'

Also checking the package exists on the folder: image

Could there be something wrong with compilation or something like that? Also is it possible to have a compiled version? I don't mind for which OS. hopefully for non CUDA.

mohammedalsayegh commented 3 years ago

I am using Python version: 3.8.5. I have the same issue of locating diffvg after what seem as successful compiling, the output of running setup.py is:

(diffvg) PS C:\Users\black\Desktop\diffvg> python setup.py install
running install
running bdist_egg
running egg_info
writing diffvg.egg-info\PKG-INFO
writing dependency_links to diffvg.egg-info\dependency_links.txt
writing requirements to diffvg.egg-info\requires.txt
writing top-level names to diffvg.egg-info\top_level.txt
reading manifest file 'diffvg.egg-info\SOURCES.txt'
writing manifest file 'diffvg.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
-- pybind11 v2.6.0 dev
-- Using pybind11: (version "2.6.0" dev)
-- Build with CUDA support
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/black/Desktop/diffvg/build/temp.win-amd64-3.8/Release
Microsoft (R) Build Engine version 16.6.0-preview-20222-04+b4f75bf75 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  diffvg.vcxproj -> C:\Users\black\Desktop\diffvg\build\lib.win-amd64-3.8\diffvg.
creating build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.8\diffvg -> build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.8\diffvg.pdb -> build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\color.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\device.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\image.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\optimize_svg.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\parse_svg.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\pixel_filter.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\render_pytorch.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\save_svg.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\shape.py -> build\bdist.win-amd64\egg\pydiffvg
copying build\lib.win-amd64-3.8\pydiffvg\__init__.py -> build\bdist.win-amd64\egg\pydiffvg
byte-compiling build\bdist.win-amd64\egg\pydiffvg\color.py to color.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\device.py to device.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\image.py to image.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\optimize_svg.py to optimize_svg.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\parse_svg.py to parse_svg.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\pixel_filter.py to pixel_filter.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\render_pytorch.py to render_pytorch.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\save_svg.py to save_svg.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\shape.py to shape.cpython-38.pyc
byte-compiling build\bdist.win-amd64\egg\pydiffvg\__init__.py to __init__.cpython-38.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying diffvg.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying diffvg.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying diffvg.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying diffvg.egg-info\not-zip-safe -> build\bdist.win-amd64\egg\EGG-INFO
copying diffvg.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying diffvg.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
creating 'dist\diffvg-0.0.1-py3.8-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing diffvg-0.0.1-py3.8-win-amd64.egg
removing 'c:\users\black\.conda\envs\diffvg\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg' (and everything under it)
creating c:\users\black\.conda\envs\diffvg\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg
Extracting diffvg-0.0.1-py3.8-win-amd64.egg to c:\users\black\.conda\envs\diffvg\lib\site-packages
diffvg 0.0.1 is already the active version in easy-install.pth

Installed c:\users\black\.conda\envs\diffvg\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg
Processing dependencies for diffvg==0.0.1
Searching for svgpathtools==1.4.1
Best match: svgpathtools 1.4.1
Adding svgpathtools 1.4.1 to easy-install.pth file

Using c:\users\black\.conda\envs\diffvg\lib\site-packages
Searching for numpy==1.19.2
Best match: numpy 1.19.2
Adding numpy 1.19.2 to easy-install.pth file
Installing f2py-script.py script to C:\Users\black\.conda\envs\diffvg\Scripts
Installing f2py.exe script to C:\Users\black\.conda\envs\diffvg\Scripts

Using c:\users\black\.conda\envs\diffvg\lib\site-packages
Searching for svgwrite==1.4
Best match: svgwrite 1.4
Adding svgwrite 1.4 to easy-install.pth file

Using c:\users\black\.conda\envs\diffvg\lib\site-packages
Finished processing dependencies for diffvg==0.0.1

After testing with finite_difference_comp.py given example:

(diffvg) PS C:\Users\black\Desktop\diffvg\apps> python finite_difference_comp.py imgs/tiger.svg
Traceback (most recent call last):
  File "finite_difference_comp.py", line 14, in <module>
    import pydiffvg
  File "C:\Users\black\.conda\envs\diffvg\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:\Users\black\.conda\envs\diffvg\lib\site-packages\diffvg-0.0.1-py3.8-win-amd64.egg\pydiffvg\render_pytorch.py", line 2, in <module>
    import diffvg
ModuleNotFoundError: No module named 'diffvg'

After rename diffvg-0.0.1-py3.8-win-amd64.egg to diffvg, I got the following output: AttributeError: module 'diffvg' has no attribute 'FilterType'

MaxGodTier commented 3 years ago

I'm experiencing the same issue using both VS 2017 and 2019 on a fresh environment after formatting my HDD, did anyone solve this? It's driving me nuts.

yael-vinker commented 3 years ago

any updates regarding this issue?

marzia-riso commented 3 years ago

I followed the install and setup instructions as reported in the repo and the compilation of the diffvg library seems to be fine. However, every python app script ends while importing the pydiffvg module, since diffvg module cannot be located. Any updated about this issue?

surjikal commented 3 years ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

marzia-riso commented 3 years ago

@surjikal It worked for me too! Thank you!

Rayerleier commented 2 years ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

nicolai256 commented 1 year ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

garlichips commented 1 year ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

same error...any updates regarding this issue?

nicolai256 commented 1 year ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

same error...any updates regarding this iss

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

same error...any updates regarding this issue?

for me it was confused if it had to use my python folder or my conda folder, once I got that right it worked smooth

ljq142105 commented 1 year ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

Hello, have you solved this problem? It has been bothering me for a long time

ljq142105 commented 1 year ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

same error...any updates regarding this issue?

Hello, have you solved this problem? It has been bothering me for a long time

Rayerleier commented 1 year ago

你可以参考这个https://zhuanlan.zhihu.com/p/560277508

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年5月17日(星期三) 晚上8:50 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [BachiLi/diffvg] Windows Diffvg missing module (#12)

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

same.. did you find any fix?

same error...any updates regarding this issue?

Hello, have you solved this problem? It has been bothering me for a long time

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Alexander-Jose commented 7 months ago

@ljq142105 , I believe I have solved this. For my install, I changed these lines in CMakeLists.txt cmake_minimum_required(VERSION 3.12) ->cmake_minimum_required(VERSION 3.18) find_package(PythonLibs REQUIRED)->find_package(PythonLibs EXACT 3.7 REQUIRED)

The CMake version may not make a difference, but in my case, the issue was that the built module was trying to use the python library for a newer version, so requiring exactly 3.7 fixed it.

Shehjad-Ishan commented 7 months ago

@ljq142105 , I believe I have solved this. For my install, I changed these lines in CMakeLists.txt cmake_minimum_required(VERSION 3.12) ->cmake_minimum_required(VERSION 3.18) find_package(PythonLibs REQUIRED)->find_package(PythonLibs EXACT 3.7 REQUIRED)

The CMake version may not make a difference, but in my case, the issue was that the built module was trying to use the python library for a newer version, so requiring exactly 3.7 fixed it.

It didn't solve my problem. I am running from a conda env. Only python 3.7 is installed.

CCCpeggy commented 5 months ago

What worked for me, for whatever reason, is renaming the site-packages/diffvg-0.0.1-py3.8-win-amd64.egg/diffvg file to diffvg.pyd

I do this, and then get the error:ImportError: DLL load failed while importing diffvg:

I reinstalled my pillow library. It works for me.