BachiLi / diffvg

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

cmake error: build fail on CUDA 9.1 #79

Closed Yi-Lynn closed 8 months ago

Yi-Lynn commented 8 months ago

Many thanks for your work!

I am trying to re-implemented this project: SceneSketch, which replied on the diffvg. But I was unable to install diffvg on my Ubuntu.

My Environment Ubuntu 18.04 Python 3.8.0 torch 1.11.0+cu113 CUDA 9.1 highest CUDA version supported by the GPU driver: 11.4

Install procedure I followed

git clone https://github.com/BachiLi/diffvg.git
cd diffvg
git submodule update --init --recursive
python setup.py install

Error log

/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************
  self.initialize_options()
/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************
  self.initialize_options()
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'
adding license file 'LICENSE'
writing manifest file 'diffvg.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
-- pybind11 v2.6.0 dev
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Using pybind11: (version "2.6.0" dev)
-- Build with CUDA support
CMake Error at /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find CUDA: Found unsuitable version "9.1", but required is at
  least "10" (found /usr)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.21/Modules/FindCUDA.cmake:1264 (find_package_handle_standard_args)
  CMakeLists.txt:19 (find_package)

-- Configuring incomplete, errors occurred!
See also "/ai4hh/ai4h/jianfeiyang/lynn/SceneSketch/diffvg/build/temp.linux-x86_64-cpython-38/CMakeFiles/CMakeOutput.log".
See also "/ai4hh/ai4h/jianfeiyang/lynn/SceneSketch/diffvg/build/temp.linux-x86_64-cpython-38/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "setup.py", line 92, in <module>
    setup(name = 'diffvg',
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/command/install.py", line 84, in run
    self.do_egg_install()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/command/install.py", line 132, in do_egg_install
    self.run_command('bdist_egg')
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 167, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 153, in call_command
    self.run_command(cmdname)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/command/install_lib.py", line 111, in build
    self.run_command('build_ext')
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "setup.py", line 31, in run
    super().run()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 88, in run
    _build_ext.run(self)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
    self.build_extensions()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
    self._build_extensions_serial()
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
    self.build_extension(ext)
  File "setup.py", line 65, in build_extension
    subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
  File "/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/ai4hh/ai4h/jianfeiyang/lynn/SceneSketch/diffvg', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/ai4hh/ai4h/jianfeiyang/lynn/SceneSketch/diffvg/build/lib.linux-x86_64-cpython-38', '-DPYTHON_LIBRARY=/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/lib', '-DPYTHON_INCLUDE_PATH=/home/jianfeiyang/jianfeiyang/anaconda3/envs/scene1/include/python3.8', '-DCMAKE_BUILD_TYPE=Release', '-DDIFFVG_CUDA=1']' returned non-zero exit status 1.`

The highlighted red lines says:

CMake Error at /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find CUDA: Found unsuitable version "9.1", but required is at
  least "10" (found /usr)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.21/Modules/FindCUDA.cmake:1264 (find_package_handle_standard_args)
  CMakeLists.txt:19 (find_package)

It seems like my CUDA version is too old to build diffvg. I am new to this tool and quite confused about this cmake issue. Is there any way to fix this without having to install a newer version of the CUDA? Thanks!!!

p.s.Some previous issues have already discussed similar error log: 37#issue and 33#issue, but none of them can solve my problem.

Yi-Lynn commented 8 months ago

A quick note on how I address this issue, hopefully useful for people running into similar situations:

  1. I reset the environment variable CUDA_TOOLKIT_ROOT_DIR to the installation path of the specific version of CUDA I need. Then the error Could NOT find CUDA: Found unsuitable version "9.1", but required is at least "10" (found /usr) was resolved.
  2. However, another problem arose with the PYTHONLIB (the same error as mentioned in 77#issue).
  3. So I cleaned the whole diffvg folder from my project, and reinstalled it again, then the CMake error message was gone. But again I got the non-zero exit status 2 error as 37#issue.
  4. Finally, this 37#issue was addressed by reinstalling the GCC, referring to the solution from 37#issuecomment-1645270294.